Search code examples
androidfirebase-cloud-messagingandroid-permissionsruntime-permissionsandroid-13

Android 13. Do I need to add POST_NOTIFICATIONS permission when use FCM?


Do I need to add permission (from API 33) android:name="android.permission.POST_NOTIFICATIONS to MY manifest if I 'm using FCM.

From documentation:

By default, the FCM SDK (version 23.0.6 or higher) includes the POST_NOTIFICATIONS permission defined in the manifest.

That is why I did not quite understand whether it is necessary to add this permission to the manifest and request it at runtime if FCM already uses it.

Please, help me to understand it.

UDD: I checked on android 13, the permission was requested the first time I launched the app, even though I didn't add any code to request the permission. Why was the permission requested by itself? At what point is it requested? Will it be asked again


Solution

  • Technically, you shouldn't have to, but it's probably a good idea to do it anyway.

    One way or another, that permission will end up in your app's final manifest. It'll be merged from the FCM SDK when you build your app, but there's no downside to you adding it in your own manifest. But on the upside, anyone looking at your code later will immediately know that the permission is there, without having to dig through your code to figure out that the permission is being merged from the FCM SDK