Android 13 Notification Permission Handling - infobip/mobile-messaging-sdk-android GitHub Wiki
Starting from Android 13, Google requires to ask user for notification permission. More information can be found on official Android documentation.
MobileMessaging SDK will automatically ask user for Push Notification Permission starting from Android 13+. It is possible to disable this default behaviour. This might be needed in case your app should support other push notifications vendors in addition to (or instead of) Infobip's one, or you want to have a more flexible approach of when and where the user will be prompted to allow receiving Push Notifications.
In order to not ask automatically Push Notification Permission, it is possible to use withoutRegisteringForRemoteNotifications()
method:
MobileMessaging
.Builder(application)
.withoutRegisteringForRemoteNotifications()
.build()
expand to see Java code
new MobileMessaging
.Builder(getApplication())
.withoutRegisteringForRemoteNotifications()
.build();
To trigger notification permission request at any time, the following code should be invoked:
MobileMessaging.getInstance(context).registerForRemoteNotifications()
expand to see Java code
MobileMessaging.getInstance(context).registerForRemoteNotifications();
If user does not accept Notification Permission Request, he won't be able to receive push notifications. In order to enable push notifications, user needs to be redirected to the Phone Settings and needs to enable Notifications permission.