I have an Android app with firebase notification services currently on deployment. The google-services.json file associated with it had wrong entries. I fixed the .json file and firebase services are now working as usual for newly installed apps. But for current users it is not working (Because it is still using the old token).
Called when the system determines that the tokens need to be refreshed. The application should call getToken() and send the tokens to all application servers.
This will not be called very frequently, it is needed for key rotation and to handle Instance ID changes due to:
- App deletes Instance ID
- App is restored on a new device
- User uninstalls/reinstall the app
- User clears app data
The system will throttle the refresh event across all devices to avoid overloading application servers with token updates.
I tried deleting the instanceId programmatically (So I get a new token); it gets deleted (no exception is thrown) but then the new token is the same as the old one.
Shouldn't changing the google-services.json trigger a token change automatically?
How can I solve this without re-installing the app for current users (on update)?
I am using the latest versions of Firebase and google-services (in Gradle).
You can update your app by submitting the new apk to the play store. So after old customers update your apk old customers will be replaced by new apk and new google-services.json file. Make sure your code is written to call the onRefreshToken() method and get the new token and send it to your server for further communication. When this is updated. All your new customers will be able to receive the notifications.