Configuring Xiaomi Push

For more information about using the Push Amp Plus version below 2.0.00, refer to the Push Amp Plus Legacy documentation.

Configure your account on MoEngage

Navigate to the Settings Page Dashboard --> Settings --> Channel --> Push --> Mobile Push --> Push Amp+ on the MoEngage Dashboard and add the Xiaomi Push Settings under the Push Amp+ Tab.


For more information, refer to Configuring Xiaomi Push on MoEngage.



If you are already using an older push-amp-plus SDK, refer to the Migration Guide before updating the integration to the latest version.

SDK Installation

Installing using Catalog

Integration using a Version Catalog is the recommended way of integration, refer to the Configure Version Catalog document to configure a catalog if not done already. Once you have configured the catalog add the dependency in the app/build.gradle file as shown below

dependencies {

Alternatively, you can add the dependency using Artifact ID as described in Installation using Artifact ID. However, installation using Catalog ID is the recommended approach as installing using Artifact ID may lead to version mismatch if mapped incorrectly. 

Add dependency of Mi SDK

Download the Mi SDK from here and it to the libs folder of the application module of your project.

Add the below configuration in the build.gradle of the app module.

android {
      repositories {
        flatDir {
            dirs 'libs'
} dependencies { implementation fileTree(dir: 'libs', include: ['*.jar', "*.aar"]) ... }

If you are using the new project structure i.e. structure applicable from the Android Gradle plugin version 7.0.0 and above, add the following in the dependencyResolutionManagement block of your settings.gradle

dependencyResolutionManagement {
    // add the below in your project.
    repositories {

Add MoEngage Files

  • Download the MoEngage files from here.
  • Create a package with the name
  • Paste the downloaded files in the above package.

Push handled by the MoEngage SDK

Add Reciever in the Manifest file

If you want the MoEngage SDK to handle token registration and push notifications, add the following receiver to your application's AndroidManifest.xml.

    <action android:name="com.xiaomi.mipush.RECEIVE_MESSAGE" />
    <action android:name="com.xiaomi.mipush.MESSAGE_ARRIVED" />
    <action android:name="com.xiaomi.mipush.ERROR" />

Initialising Mi Push

To initialize Push Amp Plus call the below API when the application comes to the foreground.

Kotlin Java
MiPushHelper.initialiseMiPush(context, appKey, appId, region)


appKey - App-Key from the Mi Dashboard.
appId - App-Id from the Mi Dashboard.

region - The region in which the Mi data should reside. Set the region using the Region enum from the Mi SDK.

Refer to the Github Sample for a reference implementation.

Push handled by the Application

If the application is handling token registration and notification via its own receiver the application would have to pass on the Push token and the MiPushMessage received on notification click to the MoEngage SDK.

Pass the Push token

Use the passPushToken() API to pass the push token to the MoEngage SDK

Kotlin Java
MoEMiPushHelper.getInstance().passPushToken(context, pushToken)

Setup Region

Set the region in which the Mi data resides. To fetch the region of the token call MiPushClient.getAppRegion(context) API. Pass the region(String returned from the API) to the below API. 

MiPushHelper.setDataRegion(context, region)


region - The region in which the Mi data should reside.

Pass Callback on Notification Click

Use the below API to pass the notification click callback to the MoEngage SDK.
You would need to override the onNotificationMessageClicked() of the PushMessageReceiver class and pass the data to the SDK using the onNotificationClicked() API as shown below.

Kotlin Java
MiPushHelper.getInstance().onNotificationClicked(context, message)

This API is responsible for inflating the desired Activity of click. Please ensure this API is called on the main thread.

If you have multiple providers sending push notifications, make sure you check if the notification is sent from the MoEngage platform or not using the following API:

Kotlin Java

So the final implementation of the onNotificationMessageClicked() as described:

override fun onNotificationMessageClicked(context: Context?, message: MiPushMessage?) 
     if (message == null || context == null) {
      if (MiPushHelper.getInstance().isFromMoEngagePlatform(message)) {
          MiPushHelper.onNotificationClicked(context, message)


MoEngage SDK takes care of re-directing the user to the selected screen or deep-link, do not add any logic for redirection.

Guidelines for Token Registration

If you are application is handling push tokens, then please follow the guidelines

  • Register for Mi Push only if the device manufacturer is Xiaomi.
  • Register for Mi Push only if the device has MIUI. You can use the helper API provided by MoEngage SDK to check whether the device has MIUI installed; use MoEMiPushHelper.getInstance().hasMiUi().
  • Add a retry mechanism in case of push registration failure.


When you register MoEngage SDK, all the above is taken care of. MoEngage recommends that you let MoEngage SDK register for the push token.


Was this article helpful?
1 out of 2 found this helpful

How can we improve this article?