Is FCM token refreshed on app update?

后端 未结 3 1166
梦谈多话
梦谈多话 2020-12-09 10:22

I am using FCM in my android app for push notifications. I have the below class to get the fcm token.

public class MyFirebaseInstanceIdService extends Fireba         


        
相关标签:
3条回答
  • 2020-12-09 10:29

    The registration token may change when:

    • The app deletes Instance ID

    • The app is restored on a new device

    • The user uninstalls/reinstall the app

    • The user clears app data.

    You can find more info from this http://prntscr.com/dnzq9l

    https://firebase.google.com/docs/cloud-messaging/android/client

    0 讨论(0)
  • 2020-12-09 10:40

    Install/Clear Data - New Token is generated.

    Update from Play Store - Token remains same.

    If you want to call onTokenRefreshed() you should do it manually.

    Click here to read more about it.

    0 讨论(0)
  • 2020-12-09 10:42

    As pointed out in the post by @Dharmitabhatt in the comments section, a registration token is not refereshed when an app is updated.

    Whenever a token is refreshed in Android, it should call the onTokenRefresh() method:

    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.

    So you are right to say that updating the app doesn't necessarily refresh the token.

    0 讨论(0)
提交回复
热议问题