-
Notifications
You must be signed in to change notification settings - Fork 658
Description
Environment
- Android Studio version: Android Studio Meerkat | 2024.3.1
- Firebase Component: Messaging
- Component version: FirebaseBomVersion = '33.7.0'
Problem description
We’re encountering an issue when calling FirebaseMessaging.getInstance().token to fetch the FCM token on certain devices. The following exception is thrown:
java.io.IOException: java.util.concurrent.ExecutionException: java.io.IOException: TOO_MANY_REGISTRATIONS
From previous threads, this seems to occur in two main scenarios:
- The device has too many apps registered with FCM.
- The device is cloned, resulting in multiple devices with the same identifiers.
However, there’s no official documentation detailing the actual limits involved. We would like to understand this more clearly:
- Is the limit per device across all apps?
- Or per device per Firebase project?
- Or per device per app?
If it’s per device globally, it’s unreasonable to expect users to uninstall random apps—especially since most won’t even use FCM. If it’s per project or per app, then this error shouldn’t realistically occur unless there’s a bug in how tokens are managed.
Some additional concerns:
- Does calling getToken() generate a new token each time?
- Doesn’t the SDK listen to uninstall events and clean up tokens automatically?
- Why does the FCM backend need to retain old tokens, when only the latest one should be active per app on a device?
- If clearing Google Play Services storage doesn’t help, and the argument is that local changes aren’t propagated to the backend, then even uninstalling apps shouldn’t work either, right?
The only reliable fix in such cases seems to be a full factory reset, which is clearly not a user-friendly or scalable solution.
It would be extremely helpful to get:
- A definitive explanation of the token registration limits and scope
- Clarity on whether there’s a proper workaround at the SDK level
- Any steps we can take from the app or device side to recover from this error
Steps to reproduce:
Calling FirebaseMessaging.getInstance().token on a certain device triggers the TOO_MANY_REGISTRATIONS exception.
Relevant Code:
FirebaseMessaging.getInstance().token