I have been creating the GCM token like the following:
InstanceID instanceID = InstanceID.getInstance(this);
String token = instanceID.getToken(authorizedEntity, scope);
// [END get_token]
Log.e(TAG, "GCM Registration Token: " + token);
It was working fine, But some how I started getting "MESSENGER" term generated in some cases as a token. Not able to find a possible cause for it.
There is known bug in google. It happens also in FCM, not only GCM. Sometimes the word "AP" returned also, instead of "MESSENGER" and sometimes your own package name is returned to you. There is no fix at the moment. You can follow this issue tracker to be notified when it is resolved. As for now, the only solution I can think of is implementing re-registering mechanism with exponential back-off in time. For example, send re-register (that means unregister and register) requests after 1 second, after 2 seconds, after 4 seconds, after 16 seconds and so, until you've got registered.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With