Android 13 Notification Permission - Androhub

Android 13 Notification Permission

Android 13 Notification Permission

From Android 13, notifications won’t work until and unless we have not taken runtime permission from the user. Without this permission, the user won’t be able to receive any kind of notification to their devices.

Click Here To See The Video Tutorial.

If you migrated from Android 12 to Android 13 make sure you have made changes related to Notification permission so that your users will be able to receive the notifications.
To enable the notification permission we need to do only two steps as follows:

Declare the Permission

Open the AndroidManifest.xml and add the following permission to it.

Add Runtime Permission

Now we have to add runtime permission at the code level similarly we do for Camera, Contacts, Storage, etc permissions. The below code will show a permission dialog whenever we request the POST_NOTIFICATIONS permission.

Based on user consent the notifications will be shown to them.

Using the above two steps will enable the notification in your app and users will be able to receive them only if they allow it.

Thanks😊

 

Post comment

Your email address will not be published. Required fields are marked *