Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android GCM ID generated returns "MESSENGER" in some cases while works fine in most of the case. Unable to find a cause

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.

like image 641
asdec90 Avatar asked May 04 '16 11:05

asdec90


1 Answers

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.

like image 143
Evgeniy Mishustin Avatar answered Oct 15 '22 05:10

Evgeniy Mishustin