[Android] Provider "FCM" could not register for push
I've been struggling a lot to setup Batch for Android. I did an install with the newest react-native and newest firebase module versions. And yet, I had the following error in logcat:
Push - Provider "FCM" could not register for push: Firebase Core is missing. Did you add 'com.google.firebase:firebase-core' to your gradle dependencies?
After investigation, it turns out that the following line was reporting this issue https://github.com/BatchLabs/Batch-Android-SDK/blob/af04acfd6d6bcca28280c45d12ac52e83baaa10e/Sources/sdk/src/main/java/com/batch/android/push/FCMRegistrationProvider.java#L110
The error was thrown by this line: https://github.com/BatchLabs/Batch-Android-SDK/blob/af04acfd6d6bcca28280c45d12ac52e83baaa10e/Sources/sdk/src/main/java/com/batch/android/push/FCMRegistrationProvider.java#L158
So, the class "com.google.firebase.iid.FirebaseInstanceId" was missing.
I still don't understand why this class was not available...
A solution I found was yarn add @react-native-firebase/iid. Somehow, this provides the missing class.
I thought this could help. I don't know if this needs to be documented or not, since I'm still not sure if I made a mistake somewhere during the installation process.
Hello!
Thanks for your feedback.
This class might be missing if you're using the latest Firebase Messaging library, which made the iid classes not part of the standard distribution but available as an addon, as you've noticed.
Support for the new API (FCM Tokens) is coming in a future SDK release, but in the meantime we have added some documentation to work around the issue for our native SDK. Looks like our React Native doc is missing this.
Rest assured that IID will work perfectly for the time being as google deprecated it but didn't announce any shutdown date. Both APIs are functionally equivalent too.
We'll update our documentation with your suggestion.
Thanks!
Hi,
Fantastic, glad to hear that you will update the docs 😊 You may close the issue once this is done!
Thanks!
Unfortunately iid causes an error on iOS

https://github.com/invertase/react-native-firebase/issues/3746
Actually the iid package doesn't even exist anymore in react-native-firebase. Is there any other way around?
I downgraded everything to the latest iid version. Looks like everything works on iOS and Android.
{
"dependencies": {
"@react-native-firebase/app": "11.5.0",
"@react-native-firebase/crashlytics": "11.5.0",
"@react-native-firebase/iid": "11.5.0",
"@react-native-firebase/messaging": "11.5.0",
"@react-native-firebase/perf": "11.5.0",
}
}
instead of downgrading everything its also possible to exclude the autolink for iOS adding this on the react-native.config.js:
'@react-native-firebase/iid': {
platforms: {
ios: null,
},
},
See official Batch Android SDK Doc: https://doc.batch.com/android/sdk-integration#adding-push-notifications-support
Note: If you're using firebase-core >= 19.0 and firebase-messaging >= 22.0, please add the Firebase Installations library to your dependencies or you will not be able to receive push notifications: implementation "com.google.firebase:firebase-iid:21.1.0". A future SDK release will bring support for FCM Tokens. You can also try downgrading firebase-messaging to 21.0 by editing the firebaseMessagingVersion variable.
You can also just patch your build.gradle for Android.
Thanks @pierpo for your contribution. I'm closing this issue as Batch released a new version and this repository is being archived.
This should be addressed in https://github.com/BatchLabs/Batch-React-Native-Plugin