> ## Documentation Index
> Fetch the complete documentation index at: https://moengage.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Migrating to Firebase Installation ID

> Update your Cordova Android integration to the Firebase Installation ID when you upgrade to cordova-moengage-core 11.0.0.

From `cordova-moengage-core` 11.0.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 change applies to Android only.

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

| Your integration | Case | Required |
| - | - | - |
| The MoEngage SDK registers the token. Your application does not pass the push token to the MoEngage SDK. | [Case 1](#case-1-the-moengage-sdk-registers-the-token) | Mandatory. This is a breaking change. |
| Your application registers the token through its own messaging service and passes it to the MoEngage SDK. | [Case 2](#case-2-your-application-registers-the-token) | Recommended. The previous APIs are deprecated. |

## 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

Update `com.google.firebase:firebase-messaging` to 25.1.0 or higher. Refer to the [Firebase Android release notes](https://firebase.google.com/support/release-notes/android) for this version.

### Step 2: Enable the Firebase Installation ID

Add the following metadata to your application manifest file. In a Cordova project, add it through `config.xml` so that it persists when the Android platform is rebuilt. The `<widget>` element must declare the `xmlns:android="http://schemas.android.com/apk/res/android"` namespace.

```xml config.xml wrap theme={null}
<platform name="android">
    <config-file target="AndroidManifest.xml" parent="/manifest/application">
        <meta-data
            android:name="firebase_messaging_installation_id_enabled"
            android:value="true" />
    </config-file>
</platform>
```

Refer to the [Firebase documentation on accessing the Firebase Installation ID](https://firebase.google.com/docs/cloud-messaging/android/get-started#access-firebase-installation-id) for details.

### Step 3: Upgrade the MoEngage SDK

Upgrade `cordova-moengage-core` to 11.0.0 or above. This version requires `cordova-android` 15.1.0 or later. Refer to the [Cordova SDK release notes](https://moengage.com/docs/release-notes/sdks/cordova.md#18th-november-2026) for the native SDK 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. Without the metadata from Step 2, the SDK does not register for push, and debug builds crash at launch.

If your application listens for the `onPushTokenGenerated` event on Android, also complete [Step 6](#step-6-migrate-onpushtokengenerated-to-onfirebaseinstallationidavailable). From 11.0.0, the SDK no longer sends this event for FCM.

## Case 2: Your Application Registers the Token

Complete Step 1, Step 2, and Step 3 from [Case 1](#case-1-the-moengage-sdk-registers-the-token) first, then apply the API changes below. The replacement APIs are available only from `cordova-moengage-core` 11.0.0, so applying these changes before you upgrade results in errors.

The following table summarizes the replacements. The first two apply to every integration in this case. The last applies only if your application listens for the event listed. The code blocks in the steps below show the replacement API only, so that the code you copy is the code you keep.

| Previous API | Replacement | Applies when |
| - | - | - |
| `onNewToken` | `onRegistered` | Always |
| `passFcmToken` | `passFirebaseInstallationId` | Always |
| `onPushTokenGenerated` event | `onFirebaseInstallationIdAvailable` event | Your application listens for `onPushTokenGenerated` |

### Step 4: Migrate onNewToken to onRegistered

In your native messaging service class, which extends `FirebaseMessagingService`, replace the `onNewToken` callback with `onRegistered`. The callback receives the Installation ID instead of the push token.

| Previous | Current |
| - | - |
| `onNewToken(token: String)` | `onRegistered(installationId: String)` |

The code block below is the replacement. Copy it as it is.

```Kotlin Kotlin wrap theme={null}
override fun onRegistered(installationId: String) {
}
```

```Java Java theme={null}
@Override
public void onRegistered(@NonNull String installationId) {
}
```

Refer to the [Firebase documentation on the onRegistered callback](https://firebase.google.com/docs/cloud-messaging/android/get-started#implement-the-onregistered-callback) for details.

### Step 5: Migrate passFcmToken to passFirebaseInstallationId

Call `passFirebaseInstallationId()` in place of `passFcmToken()` to pass the Installation ID to the MoEngage SDK.

| Previous | Current |
| - | - |
| `passFcmToken(token)` | `passFirebaseInstallationId(installationId)` |

The code block below is the replacement. Copy it as it is.

```javascript JavaScript theme={null}
var moe = MoECordova.init(YOUR_WORKSPACE_ID);
moe.passFirebaseInstallationId(installationId);
```

If your application passes the token from native Android code instead, follow [Step 5 of the Android migration](https://moengage.com/docs/developer-guide/android-sdk/migration/migrating-to-firebase-installation-id.md#step-5-migrate-passpushtoken-to-passinstallationid).

### Step 6: Migrate onPushTokenGenerated to onFirebaseInstallationIdAvailable

Apply this step only if your application listens for the `onPushTokenGenerated` event on Android. Listen for the `onFirebaseInstallationIdAvailable` event instead. To read the Installation ID that the SDK holds at any time, call `getFirebaseInstallationId()`.

| Previous | Current |
| - | - |
| `onPushTokenGenerated` | `onFirebaseInstallationIdAvailable` |

The code block below is the replacement. Copy it as it is.

```javascript JavaScript theme={null}
var moe = MoECordova.init(YOUR_WORKSPACE_ID);
moe.on('onFirebaseInstallationIdAvailable', function (payloadInfo) {
});
```

### Impact

Case 2 is not a breaking change. Your application keeps registering for push on 11.0.0 without these API changes, because it supplies the identifier itself. Only [Case 1](#case-1-the-moengage-sdk-registers-the-token) 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.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.