-
Notifications
You must be signed in to change notification settings - Fork 2.3k
requestAuthorizationWithOptions before registerForRemoteNotifications #3017
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
requestAuthorizationWithOptions before registerForRemoteNotifications #3017
Conversation
Simone Carcone seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account. You have signed the CLA already but the status is still pending? Let us recheck it. |
Fabulous - I think there are many reasons for the issue linked but if you've tested this as a fix for some of them, great! Thanks for the PR |
Yes, I think so, but after this commit of Salakar, probably this bug is the most frequent (reading the last messages) |
Codecov Report
@@ Coverage Diff @@
## master #3017 +/- ##
=========================================
+ Coverage 89.83% 90.1% +0.27%
=========================================
Files 109 109
Lines 3381 3381
=========================================
+ Hits 3037 3046 +9
+ Misses 344 335 -9 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for figuring this out, duplication is fine for now to get this fixed. I'll make a note on our internal tracker to see if we can de-dupe after we release Notifications - as we'll look at adding some internal changes to messaging to make it integrate better.
Summary
Fixes #2657
This pull request solves the problems with
request permission
andregisterForRemoteNotifications
in messaging module.When these methods are called, they simply fail without throwing any warnings or errors. Because of this, it was impossible to get the FCMToken.
The problem was that
[[UIApplication sharedApplication] registerForRemoteNotifications];
should be called after[[UNUserNotificationCenter currentNotificationCenter] requestAuthorizationWithOptions
as described in the documentationThere is some code duplication in this commit, but I think that is better for now, to help the reviewers.
Checklist
Android
iOS
e2e
tests added or updated in packages/**/e2eTest Plan
After calling
request permission
andregisterForRemoteNotifications
a FCMToken is returned bymessaging().getToken()
Release Plan
[CATEGORY][type] [LOCATION] - Message
[ IOS] [ BUGFIX] [MESSAGING] - Solves the problems with
request permission
andregisterForRemoteNotifications
in messaging module.Think
react-native-firebase
is great? Please consider supporting the project with any of the below:React Native Firebase
andInvertase
on Twitter