Skip to content

Commit

Permalink
Updated comments for more clarity on when onNewToken is called (fireb…
Browse files Browse the repository at this point in the history
…ase#1242)

Given the lengthy history of obtaining the token from C2DM, GCM, FCM, and the transition from InstanceID to Installation SDK, added additional clarity to outline all the known scenarios onNewToken is called to match with the details from https://firebase.google.com/docs/cloud-messaging/android/client#sample-register
  • Loading branch information
joeykrim authored Jan 5, 2021
1 parent 0c39fb9 commit 7126776
Showing 1 changed file with 7 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -104,10 +104,13 @@ public void onMessageReceived(RemoteMessage remoteMessage) {

// [START on_new_token]
/**
* Called if FCM registration token is updated. This may occur if the security of
* the previous token had been compromised. Note that this is called when the
* FCM registration token is initially generated so this is where you would retrieve
* the token.
* There are two scenarios when onNewToken is called:
* 1) When a new token is generated on initial app startup
* 2) Whenever an existing token is changed
* Under #2, there are three scenarios when the existing token is changed:
* A) App is restored to a new device
* B) User uninstalls/reinstalls the app
* C) User clears app data
*/
@Override
public void onNewToken(String token) {
Expand Down

0 comments on commit 7126776

Please sign in to comment.