Deleting the Instance ID token does not trigger onNewToken
See original GitHub issue[READ] Step 1: Are you in the right place?
Yes
[REQUIRED] Step 2: Describe your environment
- Android Studio version: 4.1.1
- Firebase Component: Messaging
- Component version: 21.0.1
[REQUIRED] Step 3: Describe the problem
Inconsistency between iOS and Android SDKs when a token is deleted. On iOS, there was an update to the SDK to make sure the listener refreshed, please see p/r https://github.com/firebase/firebase-ios-sdk/pull/5339. Unable to reproduce same behaviour on Android.
Steps to reproduce:
- get Firebase Messaging Token
FirebaseInstanceId.getInstance().getToken();
- delete Firebase Messaging Token
FirebaseInstanceId.getInstanceId().deleteInstanceId()
- get Firebase Messaging Token
FirebaseInstanceId.getInstance().getToken();
Token is updated, but FirebaseMessagingService onNewToken
is not triggered, unlike on iOS.
Issue Analytics
- State:
- Created 3 years ago
- Comments:7 (4 by maintainers)
Top Results From Across the Web
How can I trigger manually a Firebase onNewToken call?
First of all you need to delete old instance id and after that, get id using FirebaseInstanceId.getInstance().getInstanceId(); . Example:
Read more >FirebaseMessagingService. onNewToken() method is called ...
onNewToken () method is called even though token is not changed after ... The app deletes Instance ID; The app is restored on...
Read more >Best practices for FCM registration token management
In addition to removing tokens in obvious cases of invalid token responses, ... Determining whether a token is fresh or stale is not...
Read more >Obtaining and Deleting a Push Token-Basic Capabilities ...
If no token is returned by getToken, the onNewToken method can be used to obtain one. ... Therefore, the token will not be...
Read more >Remote Notifications with Firebase Cloud Messaging - Xamarin
FCM notifications overview; Requirements; Start an app project ... If you do not see an instance ID token, add the following line to...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I’ve put together a fix for this (internal ref 365888536) and it should be rolling out in the next FCM release.
Yes, in general the future is to go through either
FirebaseInstallations
(for IDs) orFirebaseMessaging
(for FCM registration tokens). TheFirebaseInstallations.getToken
method returns an installations auth token, which is distinct from the FCM registration token. For sending an FCM message to an app instance, theFirebaseMessaging.getToken
method is the right one to use.@ciarand great! @helenaford note this is packaged in firebase-android-sdk 27.0.0 which is a breaking change for react-native-firebase and we haven’t ported yet 😅 https://github.com/invertase/react-native-firebase/issues/5150
I believe based on BoM comparision if you are not using the admob module that you can overrde the sdk and everything will be fine but it’s untested as of yet