1

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

testivanivan
  • 967
  • 13
  • 36

1 Answers1

2

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

user496854
  • 6,461
  • 10
  • 47
  • 84
  • Thank you for answer, So, starting with android version 13, should I request this permission at runtime anyway? – testivanivan Sep 20 '22 at 14:45
  • Did you never show local notifications, only FCM, then I don't think you have to. But just to be on the safe side, you should test it without requesting them, and see if the push notifications come through – user496854 Sep 20 '22 at 16:21
  • When I installed the application from scratch, the permission was requested, despite the fact that I did not add the code for this. However, after re-installing, the permission was no longer requested, so I'm not sure if users will see this permission if they update the application. – testivanivan Sep 20 '22 at 16:46
  • 1
    It depends on tour target sdk. If it's < 33, it auto-requests it – user496854 Sep 20 '22 at 18:45
  • That is, if I have target sdk >= 33 , then I have to request permission myself in my code ? – testivanivan Sep 20 '22 at 18:52
  • 1
    Yes, that's how it works – user496854 Sep 20 '22 at 21:23