Push Service Activation Guide更新时间: 2024-10-09 14:02:00

This document mainly introduces the steps to enable Mi Push to help developers more quickly complete their access.
Before using the Mi Push service, please read the "Mi Push Privacy Policy".

一、Register a Xiaomi Developer Account

If you already have a Xiaomi developer account, you can ignore this section and go to "2. Enable Push".
Visit Mi Developer Console and refer to the Developer account registration process to complete the Xiaomi developer account registration.If you already have a developer account, please use it to log in directly to the developer site.
Reviewing developer accounts generally takes 1-3 working days. Please go to the developer website to check results of your account review.

二、Enable Push

Push Operational Console
Use your developer account to log in to the Push Operational Console. Note that for apps distributed in non-Mainland China, you need to select a region other than "Mainland China" to view.
Push Service App List
The app list includes the existing apps under the developer account (Including Android phone/tablet apps, and Android TV apps).
Description:

Tap "Enable Push" in the "Not Enabled" app to enter the page for enabling message pushing.
Enable push

Before enabling push, you must read the "Mi Push Technology Terms of Service" and "Mi Push Technology Service Data Protection Appendix".Select Agree to enable.
Create app
If the app you want to use is not in the app list, select "Create App" and choose to create a phone/tablet app or TV app.

Select the default language, fill in the app name and package name, and tap Create to create a new app.

After the app is created, you can enable push services for the app.
After enabling push services, you can view the AppId, AppKey, and AppSecret corresponding to the app on the "App management - App info" page.

The AppId and AppKey represent the client's identity, used when the client SDK is initialized; AppSecret is the server's identity, used when using the server SDK to send messages to the client.

三、Access PUSH SDK

Android
If the country you have selected for app distribution/service is the People's Republic of China (Excluding Hong Kong, Macau, or Taiwan), you need to integrate the Mainland China version of the PUSH client SDK.If the country or region you have selected for app distribution/service is outside the People's Republic of China (Excluding Hong Kong, Macau, or Taiwan), you need to integrate the non-China version of the PUSH client SDK, and you need to set the data storage location yourself (See "Register Push Service" for details).
How to get SDK:
• SDK for Mainland China
    Please visit the SDK download page (Mainland China version) to download the latest version of the Android client SDK.
    Access guide: https://dev.mi.com/xiaomihyperos/documentation/detail?pId=1544
• SDK for non-Mainland China
   Please visit the SDK download page (Non-Mainland China version) to download the latest version of the Android client SDK.
   Access guide: https://dev.mi.com/xiaomihyperos/documentation/detail?pId=1692
Currently, Xiaomi has data centers in China, Mumbai (India), Frankfurt (Germany), Moscow (Russia), and Singapore.When you integrate the Mainland China version of the PUSH client SDK with MIUI devices of Mainland China version, your app and end user data will be stored in Mainland China.When you integrate the PUSH client SDK of a non-Mainland China version, please select the applicable software version and data storage location in accordance with relevant laws, regulations, and regulatory requirements.Mi Push Service will store and process users' personal information according to your instructions.When you send a message to a MIUI device, if the data storage location you select is different from the region set by the user, we will prioritize the region set by the user when determining the data storage location after obtaining your authorization.If you have any questions about this, please contact us through the Push Ticket System.

四、Push messages

After integrating the PUSH client SDK, you can use the push service to push messages through 3 ways:
• Server-side Java SDK push: Please refer to "Guide for Mi Push Server Side SDK (Java)"
• Server-side API push: Please refer to "Server API Address and Parameters"
Note:
You need to use different server-side APIs or operating consoles to push messages depending on whether the app distribution/service area is Mainland China or non-Mainland China, as shown in the following table:

Server APIPush Operational Console
The application distribution/service region is Mainland China (Excluding Hong Kong, Macau, or Taiwan)• Java SDK method:Sender sender = new Sender(APP_SECRET_KEY);• HTTPS method:https://api.xmpush.xiaomi.comhttps://admin.xmpush.xiaomi.com/zh_CN
The application distribution/service region is Russia• Java SDK method: Sender sender = new Sender(APP_SECRET_KEY, Region.Russia);• HTTPS method: https://ru-api.xmpush.global.xiaomi.comhttps://admin.xmpush.xiaomi.com/en Select【Russia】
The application distribution/service region is India<• Java SDK method: Sender sender = new Sender(APP_SECRET_KEY, Region.India);• HTTPS method: https://idmb-api.xmpush.global.xiaomi.comhttps://admin.xmpush.xiaomi.com/en Select【India】
The application distribution/service regions are European Economic Area countries+UK• Java SDK method: Sender sender = new Sender(APP_SECRET_KEY, Region.Europe);• HTTPS method: https://fr-api.xmpush.global.xiaomi.comhttps://admin.xmpush.xiaomi.com/en Select【European Economic Area countries+UK】
The application distribution/service region is other countries/regions• Java SDK method: Sender sender = new Sender(APP_SECRET_KEY, Region.Singpore);• HTTPS method: https://sgp-api.xmpush.global.xiaomi.comhttps://admin.xmpush.xiaomi.com/en Select【Other】