DJ-DOO
DJ-DOO

Reputation: 4780

FirebaseInstanceIdService on TokenRefresh

I implemented push notifications on my app a couple of months ago. My problem is we had to change the firebase cert on AWS and now there are a lot of push notification failures. We are due to rollout an update on Monday.

I know in the following cases:

FirebaseInstanceIdService gets fired and in turn onTokenRefresh() gets called. My question is however, if the user receives an update to their application, is that service also fired, is an update the equivalent to app is restored on a new device?

This will solve the push failures if so as I register the token with AWS on receipt,

Any info would be great

Upvotes: 0

Views: 214

Answers (2)

Ajay S
Ajay S

Reputation: 48612

My question is however, if the user receives an update to their application, is that service also fired, is an update the equivalent to app is restored on a new device?

Nope. App is restored on a new device means that user has upgraded to a new device.

You may want to read this thread Change/update Firebase notification token or instance id forcefully via code? for generating new token.

Upvotes: 1

Inneke De Clippel
Inneke De Clippel

Reputation: 1026

I don't think an app update will cause Firebase to create a new token. You can use this code to force Firebase:

        FirebaseInstanceId.getInstance().deleteInstanceId();
        FirebaseInstanceId.getInstance().getToken();

You can do this in your main Activity for example, and save a boolean in the shared preferences once it is done so you don't refresh the token on each launch.

Upvotes: 1

Related Questions