moengage_flutter 11.1.0, the SDK registers Android devices for push using the Firebase Installation ID, which is the identifier that Firebase assigns to each installation of an application on a device. This migration applies only to Android. The iOS integration remains unchanged.
The changes this migration requires depend on which component registers the push token in your application. Identify your case below, then complete the steps for that case.
Which Case Applies to Your Application
Case 1: The MoEngage SDK Registers the Token
This case is a breaking change. Complete all three steps, in order.Step 1: Update the Firebase Messaging Library
In theandroid/app/build.gradle file of your Flutter project, update com.google.firebase:firebase-messaging to 25.1.2 or higher. Refer to the Firebase Android release notes for this version.
Step 2: Enable the Firebase Installation ID
Add the following metadata to theandroid/app/src/main/AndroidManifest.xml file.
Step 3: Upgrade the MoEngage Plugin
Upgrademoengage_flutter to 11.1.0 or above. Refer to the Flutter SDK release notes for the plugin versions included in this release.
Impact
This migration is mandatory. Complete all three steps correctly, because an incomplete migration affects reachability and causes a push token drop.Case 2: Your Application Registers the Token
Complete Step 1, Step 2, and Step 3 from Case 1 first, then apply the API changes below. The replacement APIs are available only frommoengage_flutter 11.1.0, so applying these changes before you upgrade results in compilation errors.
The following table summarizes the replacements. The first two apply to every integration in this case. The remainder apply only if your application currently calls the API listed. The code blocks in the steps below show the replacement API only, so that the code you copy is the code you keep.
Step 4: Migrate onNewToken to onRegistered
In your Android messaging service class, which extendsFirebaseMessagingService, replace the onNewToken callback with onRegistered. The callback receives the Installation ID instead of the push token.
The code block below is the replacement. Copy it as it is.
Step 5: Migrate passFCMPushToken to passFirebaseInstallationId
CallpassFirebaseInstallationId() in place of passFCMPushToken to pass the Installation ID to the MoEngage SDK. This call is on MoEngageFlutter.
The code block below is the replacement. Copy it as it is.
Step 6: Migrate the Push Token Callback
Apply this step only if your application sets a push token callback. CallsetFirebaseInstallationIdCallbackHandler() in place of setPushTokenCallbackHandler, and replace PushTokenCallbackHandler with FirebaseInstallationIdCallbackHandler, which receives a FirebaseInstallationIdData object instead of PushTokenData. This call is on MoEngageFlutter.
The code block below is the replacement. Copy it as it is.
Step 7: Read the Stored Installation ID
Apply this step only if your application needs to read the identifier that the SDK holds. CallgetFirebaseInstallationId(), which returns a FirebaseInstallationIdData object, or null if the SDK does not hold an Installation ID. This call is on MoEngageFlutter, and the plugin had no equivalent call for the push token.
The code block below shows the call. Copy it as it is.
If your Android code calls
MoEFireBaseHelper APIs directly, such as registerForToken, getPushToken, or addTokenListener, also complete the matching steps in the Android migration guide.Impact
Case 2 is not a breaking change. Your application keeps registering for push onmoengage_flutter 11.1.0 without these API changes, because it supplies the identifier itself. Only Case 1 is mandatory.
MoEngage still recommends the migration. The Installation ID remains available when Firebase refreshes or drops the push token, which keeps reachability consistent, and it replaces the token APIs, which are deprecated.