requestNotificationPermission

fun requestNotificationPermission(activity: Activity, isRationaleActivity: Boolean = false, requestCode: Int = DEFAULT_NOTIFICATION_PERMISSION_REQUEST_CODE): NotificationPermissionRequestResult

Handles the flow for requesting the android.Manifest.permission.POST_NOTIFICATIONS permission required for push notifications from Android 13(T)+. This is a no-op on earlier Android versions and will return NotificationPermissionRequestResult.PERMISSION_NOT_REQUIRED.

Parameters

activity

The activity to use to make the permissions request. The response will be returned in the activity onRequestPermissionsResult implementation. It is recommended that syncNotificationSettings is called from there.

isRationaleActivity

Boolean representing whether the activity provides details to the user justifying the need for the notifications permission. This is not requited for the first request (although it is highly recommended) but if the user has denied the request previously it should be shown before repeating the request.

requestCode

The request code used to track the permissions request. This will be returned in the Activity.onRequestPermissionsResult call to identify the result. Defaults to DEFAULT_NOTIFICATION_PERMISSION_REQUEST_CODE.