This topic describes how to integrate the MiPush channel SDK for Mobile Push.
Before you begin
You have integrated the Mobile Push SDK as described in Integrate the Android SDK.
You have enabled the MiPush service. If not, log on to the Xiaomi Open Platform, go to the push operation platform, create your app, and enable its push service.
You have obtained the push credentials from MiPush. If not, log on to the Xiaomi Open Platform, register your app, and obtain its AppID, AppKey, and AppSecret.
You have configured the push credentials in the EMAS console. If not, log on to the EMAS console and configure the AppSecret for MiPush. For instructions, see Configure third-party channel keys.
Step 1: Add the SDK to your app
In your module-level (app-level) Gradle file, typically <project>/<app-module>/build.gradle, add the following SDK dependencies to the dependencies block.
See the Android SDK release notes for the correct SDK version.
dependencies {
implementation 'com.aliyun.ams:alicloud-android-third-push-xiaomi:x.x.x'
implementation 'com.aliyun.ams:alicloud-android-third-push:x.x.x'
}
The Mobile Push third-party channel SDK supports only Maven dependencies.
Step 2: Configure the SDK
1. Initialize the SDK
You must initialize the SDK in the Application class after initializing the Mobile Push SDK. Otherwise, the MiPush channel registration may fail.
Initialize the SDK as follows:
// Kotlin
MiPushRegister.register(applicationContext, "YOUR_MIPUSH_APPID", "YOUR_MIPUSH_APPKEY")
// Java
MiPushRegister.register(applicationContext, "YOUR_MIPUSH_APPID", "YOUR_MIPUSH_APPKEY");
2. Configure obfuscation rules
If your project uses code obfuscation, add the following ProGuard rules for the MiPush channel.
# MiPush channel
-keep class com.xiaomi.** {*;}
-dontwarn com.xiaomi.**
Step 3: Verify the integration
1. Enable SDK logging
// Kotlin
val pushService = PushServiceFactory.getCloudPushService()
// For debug builds only. This line is not required for release builds.
pushService.setLogLevel(CloudPushService.LOG_DEBUG)
// Java
CloudPushService pushService = PushServiceFactory.getCloudPushService();
// For debug builds only. This line is not required for release builds.
pushService.setLogLevel(CloudPushService.LOG_DEBUG);
2. Confirm successful integration
If the MiPush channel is initialized successfully, the following log is printed:

When a message is received through the MiPush channel, the following log is printed:
12-09 22:24:34.065 19566-25042/com.xxx D/MPS:MiPushReceiver: onReceiveMessage,msg=[{"f":262,"b":"{\"content\"\ ... ... ,"i":"f__-rnje3_OH74gE|VG0g3kwMnGADAGrXZku1FFW5"}]
3. Troubleshoot integration failures
If the MiPush channel registration fails (the registration success log is not displayed), check the system logs (set the logcat filter to No Filters).
Filter the logs with the regular expression PushService|BroadcastQueue. The following screenshots show examples:
MiPushBroadcastReceiveris not configured:
The
MIPUSH_RECEIVEpermission is not configured:
Next steps
You can now send notifications to the notification bar through the MiPush channel from the EMAS console. However, to handle notification taps, you must use the auxiliary pop-up window to receive push data. For details, see Integrate the auxiliary pop-up window.
When you send a push notification through a third-party channel with Mobile Push, either in the EMAS console or via an API call, you must configure server-side parameters as described in the auxiliary pop-up window documentation. Otherwise, notifications are not sent through the third-party channel.
The auxiliary pop-up window for MiPush is supported in Android SDK V2.3.0 and later.
Third-party channel FAQ
Troubleshoot issues with third-party channels and pop-up windows on Android
Conflicts between the third-party channel SDK and other SDKs on Android
The corresponding activity cannot be opened by tapping a third-party channel notification on Android
A body parsing exception is reported when the auxiliary pop-up window starts on Android