Announcements
Features
SDK for Android
SDK for iOS
SDK for macOS
test; otherwise, the messages will be blocked by Mi and marked as "unimportant messages".AppId, AppKey, and AppSecret. For more information, see Quick Connection Guide.AppID, AppKey, and AppSecret and paste them into TPNS console > Configuration Management > Basic Configuration > Mi Official Push Channel.implementation 'com.tencent.tpns:xiaomi:[VERSION]-release' // For Mi pushes, [VERSION] is the SDK's current version number, which can be obtained from the release notes of SDK for Android.
Other-Push-jar folder and import the jar packages related to Mi Push. Import xm4tpns1.1.2.1.jar to the project folder.<application><activityandroid:name="com.xiaomi.mipush.sdk.NotificationClickedActivity"android:theme="@android:style/Theme.Translucent.NoTitleBar"android:launchMode="singleInstance"android:exported="true"android:enabled="true"></activity><serviceandroid:name="com.xiaomi.push.service.XMPushService"android:enabled="true"android:process=":pushservice" /><serviceandroid:name="com.xiaomi.push.service.XMJobService"android:enabled="true"android:exported="false"android:permission="android.permission.BIND_JOB_SERVICE"android:process=":pushservice" /><!-- Note: This service must be added for version 3.0.1 or later --><serviceandroid:name="com.xiaomi.mipush.sdk.PushMessageHandler"android:enabled="true"android:exported="true" /><serviceandroid:name="com.xiaomi.mipush.sdk.MessageHandleService"android:enabled="true" /><!-- Note: This service must be added for version 2.2.5 or later --><receiverandroid:name="com.xiaomi.push.service.receivers.NetworkStatusReceiver"android:exported="true" ></receiver><receiverandroid:name="com.xiaomi.push.service.receivers.PingReceiver"android:exported="false"android:process=":pushservice"><intent-filter><action android:name="com.xiaomi.push.PING_TIMER" /></intent-filter></receiver></application><!-- Note: This is the beginning of permission required by Mi Push --><permissionandroid:name="app package name.permission.MIPUSH_RECEIVE"android:protectionLevel="signature" /><!-- Here, change application package name to the actual application package name --><uses-permission android:name="app package name.permission.MIPUSH_RECEIVE" /><!-- Here, change application package name to the actual application package name --><!-- Note: This is the end of the permissions required by Mi Push -->
receiver in AndroidManifest.xml and configure it as follows:<receiverandroid:exported="true"android:name="com.tencent.android.mipush.XMPushMessageReceiver"><intent-filter><action android:name="com.xiaomi.mipush.RECEIVE_MESSAGE" /></intent-filter><intent-filter><action android:name="com.xiaomi.mipush.MESSAGE_ARRIVED" /></intent-filter><intent-filter><action android:name="com.xiaomi.mipush.ERROR" /></intent-filter></receiver>
AppID and AppKey.XGPushConfig.setMiPushAppId(getApplicationContext(), "APPID");XGPushConfig.setMiPushAppKey(getApplicationContext(), "APPKEY");// Enable third-party pushXGPushConfig.enableOtherPush(getApplicationContext(), true);// The log of successful registration is as follows:I/TPush: [OtherPushClient] handleUpdateToken other push token is: 3CvDLfyPRArAGnv****dvQ7rYko+OthWo90rW+Edeqn53RUudp6U1dhySpV35 other push type: xiaomiI/TPush: [PushServiceBroadcastHandler] >> bind OtherPushToken success ack with [accId = 1500001048 , rsp = 0] token = 03be2036762f******33bce72d40eb5e677a otherPushType = xiaomi otherPushToken = 3CvDLfyPRArAGnv****dvQ7rYko+OthWo90rW+Edeqn53RUudp6U1dhySpV35G
-keep class com.xiaomi.**{*;}-keep public class * extends com.xiaomi.mipush.sdk.PushMessageReceiver
proguard-rules.pro file at the application project level.[OtherPushClient] handleUpdateToken other push token is: other push type: xiaomi
OtherPush to view the return code logs, for example, [OtherPush_XG_MI] register failed, errorCode: 22022, reason: Invalid package name: com.xxx.xxx. Then locate the error cause and rectify the error by referring to Troubleshooting Vendor Channel Registration Failures.Was this page helpful?
You can also Contact sales or Submit a Ticket for help.
Help us improve! Rate your documentation experience in 5 mins.
Feedback