Description
OneSignal fails to retrieve an FCM push token when the app has opted into Firebase's new Firebase Installation ID (FID)-based FCM registration. PushRegistratorFCM calls the legacy FirebaseMessaging.getToken(), which firebase-messaging 25.1.x disables when FID-based registration is enabled, throwing IllegalStateException: API disabled. As a result no push token is obtained and the device never completes push registration.
Environment
- OneSignal Android SDK: 5.9.7
- firebase-messaging: 25.1.1 (Firebase Android BoM 34.16.x)
- Also present with Braze Android SDK 43.0.0 in the same app (see root cause)
Stack trace
Unknown error getting FCM Token
java.lang.IllegalStateException: API disabled. Please use register() instead or enable this API by removing <meta-data android:name="firebase_messaging_installation_id_enabled" android:value="true" /> from your app's manifest.
at com.google.firebase.messaging.FirebaseMessaging.getToken(FirebaseMessaging.java:469)
at com.onesignal.notifications.internal.registration.impl.PushRegistratorFCM.getTokenWithClassFirebaseMessaging(PushRegistratorFCM.kt:62)
at com.onesignal.notifications.internal.registration.impl.PushRegistratorFCM.getToken(PushRegistratorFCM.kt:52)
at com.onesignal.notifications.internal.registration.impl.PushRegistratorAbstractGoogle.attemptRegistration(PushRegistratorAbstractGoogle.kt:128)
at com.onesignal.notifications.internal.pushtoken.PushTokenManager.retrievePushToken(PushTokenManager.kt:31)
Root cause
firebase-messaging 25.1.0 added FCM registration via the Firebase Installation ID and deprecated getToken(), deleteToken(), and onNewToken(). When any component opts the app into FID-based registration, Firebase disables the legacy getToken() API app-wide.
A common trigger is the Braze Android SDK 43.0.0, which automatically enables this by injecting <meta-data android:name="firebase_messaging_installation_id_enabled" android:value="true" /> into the merged manifest. OneSignal's PushRegistratorFCM.getTokenWithClassFirebaseMessaging() still calls the now-disabled getToken(), so registration fails.
Net effect: OneSignal 5.9.7 is currently incompatible with any app that enables FID-based FCM registration (which Braze 43.0.0+ does by default).
Steps to reproduce
- In an app using OneSignal 5.9.7 and firebase-messaging 25.1.x, enable FID-based registration — either add Braze 43.0.0, or add
<meta-data android:name="firebase_messaging_installation_id_enabled" android:value="true" /> to the manifest.
- Initialize OneSignal.
- Observe the
IllegalStateException: API disabled during push registration; no OneSignal subscription/Player ID or push token is generated.
Expected behavior
OneSignal registers for FCM successfully whether or not the app uses FID-based registration.
Request
Migrate PushRegistratorFCM to Firebase's new FID-based registration API (register() / onNewToken), or otherwise support token retrieval when the legacy getToken() API is disabled.
Current workaround
Override the flag back to false in the app manifest, which forces the whole app back to legacy registration:
<meta-data
android:name="firebase_messaging_installation_id_enabled"
android:value="false"
tools:replace="android:value" />
This restores getToken() for OneSignal but opts the entire app out of FID-based registration, so it is only a stopgap until OneSignal supports the new API.
Description
OneSignal fails to retrieve an FCM push token when the app has opted into Firebase's new Firebase Installation ID (FID)-based FCM registration.
PushRegistratorFCMcalls the legacyFirebaseMessaging.getToken(), whichfirebase-messaging25.1.x disables when FID-based registration is enabled, throwingIllegalStateException: API disabled. As a result no push token is obtained and the device never completes push registration.Environment
Stack trace
Root cause
firebase-messaging25.1.0 added FCM registration via the Firebase Installation ID and deprecatedgetToken(),deleteToken(), andonNewToken(). When any component opts the app into FID-based registration, Firebase disables the legacygetToken()API app-wide.A common trigger is the Braze Android SDK 43.0.0, which automatically enables this by injecting
<meta-data android:name="firebase_messaging_installation_id_enabled" android:value="true" />into the merged manifest. OneSignal'sPushRegistratorFCM.getTokenWithClassFirebaseMessaging()still calls the now-disabledgetToken(), so registration fails.Net effect: OneSignal 5.9.7 is currently incompatible with any app that enables FID-based FCM registration (which Braze 43.0.0+ does by default).
Steps to reproduce
<meta-data android:name="firebase_messaging_installation_id_enabled" android:value="true" />to the manifest.IllegalStateException: API disabledduring push registration; no OneSignal subscription/Player ID or push token is generated.Expected behavior
OneSignal registers for FCM successfully whether or not the app uses FID-based registration.
Request
Migrate
PushRegistratorFCMto Firebase's new FID-based registration API (register()/onNewToken), or otherwise support token retrieval when the legacygetToken()API is disabled.Current workaround
Override the flag back to
falsein the app manifest, which forces the whole app back to legacy registration:This restores
getToken()for OneSignal but opts the entire app out of FID-based registration, so it is only a stopgap until OneSignal supports the new API.