Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Firebase token error TOO_MANY_REGISTRATIONS

After reading 100's of threads and googling I am still confused about this following error message.

Currently, I am using Firebase Cloud Messaging and in very short terms I am trying to get my token from Firebase to be able to send messages to my server. I've tried with both these methods:

String token = FirebaseInstanceId.getInstance().getToken(mySenderId, "FCM");  String token = FirebaseInstanceId.getInstance().getToken(); 

So in the logs, I read this:

E/FirebaseInstanceId: Token retrieval failed: TOO_MANY_REGISTRATIONS                                  java.io.IOException: TOO_MANY_REGISTRATIONS 

According to other posts and answers, it's a cause of "Too many installed applications on the device that are registered with C2DM/GCM/FCM". I've also read there was a limitation of "Max 100 GCM/FCM registered applications installed on the device".

But this is not simply true, is it? I mean, it may be true but it isn't the whole answer to this issue. I am constantly working and testing with different devices and my current device DOES NOT have 100 applications registered with FCM. In fact, my device does not even have 100 applications installed at all, far from it!

Is there any way to manage previous registered devices and tokens? I've tried to run the following code without any luck:

FirebaseInstanceId.getInstance().deleteInstanceId(); 

I've tried to nail down information from different sources (including the documentation) without luck of understanding how this actually works. I've had the same issue with old the C2DM a while ago and also with GCM lately. I've merged with Firebase a few days ago to use its features instead which the thoughts of improvements on this, but it still echoes back at me.

like image 612
Fatmajk Avatar asked Nov 28 '17 11:11

Fatmajk


People also ask

What is device token in firebase FCM?

On initial startup of your app, the FCM SDK generates a registration token for the client app instance. This is the token that you must include in targeted send requests from the API, or add to topic subscriptions for targeting topics.

How can I store FCM token in database?

Step1: as soon as you get token in callback whether new or same try to save it localstorage. Step2: Call your REST API to save it to your server. it is upto you if you want to send unique user identifier along with the token.


2 Answers

After spoken directly with the Google team I got the following answer from them:

The team confirmed and clarified their data indicated that the device is not really a normal device and this is either:

  1. a virtual device (emulator) being reused too many times

  2. a real device used in automated way to test too many apps

  3. a real device which has been customized with a CLONE image of the system partition, CLONED from a different device

If this is a real device, the best way to solve it is to factory reset to the real system image of the device. Since this device is prob currently stuck in 2 or 3, would you mind factory resetting the device and let us know if the issue still reproduce?

I have performed a factory reset on my device and the issue is gone. I still don't see exactly how this can appear and why.

like image 126
Fatmajk Avatar answered Sep 21 '22 05:09

Fatmajk


I suspect that these tests are from Google robots, I just published my application and in firebase authentication three logins appear with emails that appear to be fake, such as [email protected]. All emails that I suspect are robots end with a period and a number like ".39356" I'm from Brazil and I see through Analytics that the users are from the United States, only 3, so I understand that they are tests, because I haven't published my app for the United States.

like image 38
Elvis Aron Andrade Avatar answered Sep 21 '22 05:09

Elvis Aron Andrade