-
Notifications
You must be signed in to change notification settings - Fork 242
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
firebase.messaging().requestPermission() does nothing on android #241
Comments
You are neither proposing a direct problem with the documentation nor proposing a change, so I don't see an issue requestPermission() is required in order to ask the operating system (on iOS) to listen for messages as well on v5 |
The docs are wrong in here: https://github.com/invertase/react-native-firebase-docs/blob/master/docs/messaging/receiving-messages.md: "If the user has not already granted permissions, then you can prompt them to do so, as follows: try { That is not true on Android. If user has not granted the permission, this does not prompt them to do so. |
On android it always resolves to true, because android doesn't require permission. It is however still a requirement in order to listen for messages in the background as that's the signal in v5 to attach a listener. On iOS if the user has already granted permission or the user has blocked permission they won't get a prompt either. My suggestion at this point?
If you hit the edit button on the top right and cooked something up, we could get it merged |
But android does have the notification permission options for that in settings. I used library https://github.com/riwu/react-native-open-notification to open the permission settings. Are you saying that it doesn't matter whether the user has allowed notifications on android, that he will receive those anyway? I thought the user agrees on the permissions during installation. But then he can deny that permission later on. And if he has denied those permissions, then one could think from these docs that calling requestPermissions() would prompt them to do so. So the quick hotfix for the docs is to modify that sentence. I tested and you are not required to requestPermission() (on Android) in order to get notifications. Even when the app is closed, you will get notifications without calling requestPermission. |
on Android? What versions tested? on iOS? what versions. All of this stuff changes every API it seems. You must be specific. |
Android 8.1.0, Nexus 6P. Kernel version: 3.10.73-g7bf0310 (gcc version 4.9.x-google 20140827 (prerelease) /GCC)). android-build@abfarm245 #1. Made on Thur Mar 15 22:25:39 UTC 2018. Also tested on android emulator too, Nexus 5. Version of react-native-firebase was version 5.2.5 |
Try an Android 10 emulator with react-native-permissions requestNotification vs react-native-firebase requestPermission - I think it'll pop a permission dialog in react-native-permissions because it's permission implementation is more up to date than react-native-firebase v5 That said, react-native-firebase 5.2.5 is not deployable I don't think. firebase apps will crash with pods lower than 6.5 on ios13+, which implies react-native-firebase 5.5+ series, and react-native-firebase 5.5+ |
Ok, so you mean I should update to atleast 5.5? If I remember right that requires newer version of react-native also -> need to update that too. Don't wanna do that unless no other option, since every update process of react-native has been very painful. |
Understood - react-native 0.58 to 0.59 was not so bad at least, although 0.59 to 0.60 is a HUGE leap, with 0.61 then being tiny again. Not sure if these are your exact versions but the upgrade helper dialed in from where you are to where you want to go is very very useful: https://react-native-community.github.io/upgrade-helper/?from=0.58.6&to=0.59.10 |
Any update on this one? I'm on RN 59, noticed the same issue, iOS prompts for notifications, Android does not, but auto defaults to true. Using RNFB V5. |
Use react-native-permissions if at all possible. It is by far the best way to manage permissions as it is focused on that, whereas here it is naturally just an afterthought |
Push notification permissions are automatically requested during installation for android.
The method requestPermission() does not open the permission prompt, atleast not on android. It seems to always resolve the promise, regardless of the case.
The text was updated successfully, but these errors were encountered: