Reputation: 207
I am building an app has push notification.I want, when user login with difference account I will register new Firebase token to server. But after researching for some hours,it seems Firebase only generate new token when app was uninstalled.
So my question is,is possible to get new firebase token every time when user login with new account (in same device)? Thank in advance!
Upvotes: 1
Views: 7031
Reputation: 69754
From Firebase
Docs
The registration token may change when:
Retrieve the current registration token
When you need to retrieve the current token, call FirebaseInstanceId.getInstance().getToken()
. This method returns null if the token has not yet been generated.
String myRefreshedToken = FirebaseInstanceId.getInstance().getToken();
Log.d( "myRefreshedToken" , myRefreshedToken);
Upvotes: 3
Reputation: 680
The registration token may change when:
1) The app deletes Instance ID
2) The app is restored on a new device
3) The user uninstalls/reinstall the app
4) The user clears app data.
see this official documents link when the new token can be generated for further more info:
Upvotes: 0