Migrate to Firebase Installation IDs
If you send push notifications through FCM, register Firebase Installation IDs (FIDs) with Customer.io instead of FCM registration tokens. FID mode is optional, and your existing token-based integration keeps working until you choose to migrate.
If you send push notifications through FCM, Firebase can register devices with Firebase Installation IDs (FIDs) instead of FCM registration tokens. Starting in version 4.8.0, the Customer.io Flutter SDK registers the FID on each platform where your app turns on FID registration. Until you do, the SDK keeps registering FCM tokens.
When someone opens a version of your app with FID registration turned on, the SDK replaces the device’s FCM token with the FID on their profile. You don’t need to change anything in Customer.io. To learn how FIDs differ from FCM tokens and how Customer.io sends to each, see Device IDs.
Turn on FID mode
- Update
customer_ioto 4.8.0 or later. Usefirebase-messaging25.1.2 or later on Android andFirebaseMessaging12.19.0 or later on iOS. If another package, likefirebase_messaging, pins an older Firebase version, update that package too. - Turn on FID registration in your native projects. See Firebase’s Android and Apple setup guides for details.
- Android: in
android/app/src/main/AndroidManifest.xml, inside<application>:XML<meta-data android:name="firebase_messaging_installation_id_enabled" android:value="true" /> - iOS: in
ios/Runner/Info.plist:XML<key>FirebaseMessagingInstallationIdEnabled</key> <true/>
- Android: in
- If your app forwards Firebase’s registration callbacks to Customer.io in native code, forward the FID callback instead of the token callback. Firebase calls only the FID callback in FID mode.
- Android: forward
onRegisteredinstead ofonNewToken.KOTLINoverride fun onRegistered(installationId: String) { CustomerIOFirebaseMessagingService.onRegistered(this, installationId) } - iOS: forward
messaging(_:didReceiveRegistration:)instead ofmessaging(_:didReceiveRegistrationToken:).SWIFTfunc messaging(_ messaging: Messaging, didReceiveRegistration installationId: String?) { MessagingPush.shared.messaging(messaging, didReceiveRegistration: installationId) }
- Android: forward
- If your app calls
CustomerIO.instance.registerDeviceToken(), pass the FID instead of an FCM token. You can get it withFirebaseInstallations.instance.getId()from thefirebase_app_installationspackage. Firebase doesn’t return an FCM token in FID mode. Reading the FID doesn’t register it with FCM, so FCM can’t deliver to it until Firebase registers the app. Firebase registers the app at startup by default. If you turned off FCM auto-initialization, callFirebaseMessaging.instance.register()(firebase_messaging17.0.0 or later) first, and read the FID after it completes.
To go back to FCM tokens, remove the FID setting and forward the token callbacks again.