---
# System prepended metadata

title: Android 13 Notification Permission

---

# Android 13 Notification Permission

* Add notification permission `android.permission.POST_NOTIFICATIONS` to the manifest.
* Update `androidCompileSdkVersion` and `androidTargetSdkVersion` to 33.
* Request notification
```kotlin=
// Register activity for permission request result
private val requestNotificationsPermissionLauncher: ActivityResultLauncher<String> =
    registerForActivityResult(ActivityResultContracts.RequestPermission()) { isGranted ->
}

// Check if requesting notification permission is needed
private fun shouldRequestNotificationPermission(): Boolean =
    ContextCompat.checkSelfPermission(
        this,
        Manifest.permission.POST_NOTIFICATIONS,
    ) != PackageManager.PERMISSION_GRANTED

/* 
  Ask for permssion,
  Check if the marketing is enabled too,
  a user who disabled marketing (e.g: Usercentrics) is not interested in notifications
*/
if (shouldRequestNotificationPermission() && isMarketingEnabled) {
     requestNotificationsPermissionLauncher.launch(Manifest.permission.POST_NOTIFICATIONS)
}
```

### MRs
* [Shop App](https://gitlab.com/hse24/ecom/B2C_Apps/app-now-android/-/merge_requests/1850)
* [Hello App](https://gitlab.com/hse24/ecom/B2C_Apps/next-app-android/-/merge_requests/337/)


### Offical android documation 
* [Android developer](https://developer.android.com/develop/ui/views/notifications/notification-permission)