I'm upgrading from GCM to FCM. What is the proper way to obtain a Firebase device token outside of onTokenRefresh?
I'm trying to get the device token so that I can re-enable it on my server at a later time. I initially get device token by following the documentation shown here for Method 1. However when I attempt to access the device token directly via method 2 I get a different token. Am I retrieving the device token incorrectly in method 2?
Method 1: inside of FirebaseInstanceIdService.onTokenRefresh()
String refreshedToken = FirebaseInstanceId.getInstance().getToken();
Method 2: Direct access to the device token
FirebaseInstanceId instanceID = FirebaseInstanceId.getInstance();
String registrationToken = instanceID.getToken(this.projectNumber, "FCM");