Closed ahtokca closed 2 years ago
Hello @ahtokca, I updated the other issue with some questions that can further help.
@ahtokca, Thank you for letting us know of this problem, @Samaritan1011001 's pull request fixes this issue.
This issue has been automatically locked since there hasn't been any recent activity after it was closed. Please open a new issue for related bugs.
Looking for a help forum? We recommend joining the Amplify Community Discord server *-help
channels or Discussions for those types of questions.
Before opening, please confirm:
JavaScript Framework
React Native
Amplify APIs
Push Notifications
Amplify Categories
notifications
Environment information
Describe the bug
RNPushNotification.getToken
uses deprecated APIFirebaseInstanceId.getInstance().getToken()
which returnsnull
when token is not ready. Ultimately it results into a situation when user may never get PushNotification endpoint.See details at https://firebase.google.com/docs/reference/android/com/google/firebase/iid/FirebaseInstanceId#public-string-gettoken
See example how it is implemented by @react-native-firebase/messaging at https://github.com/invertase/react-native-firebase/blob/master/packages/messaging/android/src/main/java/io/invertase/firebase/messaging/ReactNativeFirebaseMessagingModule.java
Expected behavior
Amplify follows guidelines of getting the token in correct way
https://firebase.google.com/docs/reference/android/com/google/firebase/iid/FirebaseInstanceId#getInstanceId()
Reproduction steps
Not sure if you even need them since, documentation clearly states that
FirebaseInstanceId.getInstance().getToken();
may return null if token is not readyCode Snippet
Log output
aws-exports.js
No response
Manual configuration
No response
Additional configuration
No response
Mobile Device
No response
Mobile Operating System
No response
Mobile Browser
No response
Mobile Browser Version
No response
Additional information and screenshots
No response