All Products
Document Center

Mobile Platform as a Service:Quick start

Last Updated:Feb 27, 2023

This guide briefly describes how to fast integrate MPS to the Android client. You can integrate Message Push Service (MPS) through Native AAR or Portal & Bundle method.

The complete integration process mainly includes the following four steps:

  1. Add SDK: Add the SDK dependencies and AndroidManifest configuration.

  2. Initialize the SDK: Initialize the push service to establish persistent connection between the client and the mobile push gateway.

  3. Create a service: Create a service to receive Android device IDs (Ad-tokens), so you can push messages based on device ID.

  4. Bind user ID: Report user ID to the server to bind the user ID and the device ID, so you can push messages based on the user ID.


  • You have completed the basic configuration with reference to the general operations.

  • You have obtained the .config configuration file from the mPaaS console. For how to generate and download the configuration file, see Add configuration file to project.

  • The MPPushMsgServiceAdapter method described in this guide only works in the baseline or later version. If your current baseline version is lower than, please refer to mPaaS upgrade guide to upgrade the baseline version to


    You can continue using the AliPushRcvService method in the earlier version. Click here to download the documentation about using AliPushRcvService.


To use MPS, you should complete the following steps.

  1. Add MPS SDK.

    Add the push SDK dependencies and AndroidManifest configuration.

    1. Add SDK dependencies. Choose an integration method, and complete the required steps accordingly.

      • Native AAR: Follow the instructions in AAR component management to install the PUSH component in the project through Component management (AAR).

      • Componentized integration mode (Portal & Bundle): Install the PUSH component in the Portal and Bundle projects through Component management (AAR). Fore more information, see Add component dependencies.

    2. Add AndroidManifest configuration. In the AndroidManifest.xml file, add the following content:


      If you add the SDK through Portal & Bundle, you should add the above content in the Portal project.

      <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
              <action android:name="${applicationId}.push.action.START_PUSHSERVICE" />
          <intent-filter android:priority="2147483647">
              <action android:name="android.intent.action.BOOT_COMPLETED" />
              <action android:name="" />
              <action android:name="android.intent.action.USER_PRESENT" />
              <action android:name="android.intent.action.ACTION_POWER_CONNECTED" />

      If you don't need to boot the listening system, just delete the following content:

      <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
      <action android:name="android.intent.action.BOOT_COMPLETED" />
  2. Initialize the SDK.

    Initialize the message push service to establish persistent connection between the client and the Mobile Push Gateway. The persistent connection is maintained by the SDK, and is regarded as the self-built channel.

    • Native AAR

      • If you have called the mPaaS initialization method in Application, you can call the following method behind QuinoxlessFramework.init():

      • If you haven't called the mPaaS initialization method, you can call the following methods in Application:

    • Portal & Bundle

      In LauncherApplicationAgent or LauncherActivityAgent, call the following method in postInit:

  3. Create a service.

    Create a service to inherit MPPushMsgServiceAdapter, and override the onTokenReceive method to receive the device token delivered by the self-built channel.

    public class MyPushMsgService extends MPPushMsgServiceAdapter {
         * Call back upon receiving the token delivered by the self-built channel
         * @param token Device token delivered by the self-built channel
        protected void onTokenReceive(String token) {
            Log.d("Receive the token delivered by the self-built channel: " + token);

    Declare the service in AndroidManifest.xml:

            <action android:name="${applicationId}.push.action.MESSAGE_RECEIVED" />
            <action android:name="${applicationId}.push.action.REGISTRATION_ID" />
            <category android:name="${applicationId}" />

    After you complete this step, you can push messages by device on the console. The device ID required refers to the token.

  4. Bind user ID.

    The user ID is customized by the developer. It can be the user ID of the real user system or other parameters that can form a mapping relationship with users, such as account and mobile phone number.

    After receiving the token, you can bind the token with the user ID:

    String userId = "Custom userId";
    ResultPbPB bindResult = MPPush.bind(context, userId, token);
    Log.d("Bind userId " + (bindResult.success ? "Succeeded" : ("Error:" + bindResult.code)));

    If you have already set the user ID by calling MPLogger, you don’t have to pass the user ID when binding it. For example:

    MPLogger.setUserId("Custom userId");
    ResultPbPB bindResult = MPPush.bind(context, token);

    To unbind the user ID, for example, the user exits the app, you can call the following method:

    ResultPbPB unbindResult = MPPush.unbind(context, userId, token);
    ResultPbPB unbindResult = MPPush.unbind(context, token);

    After you complete this step, you can push messages by user on the console. The user ID required refers to the custom user ID.

  • To improve the message arrival rate, you are recommended to integrate the push channels provided by Android mobile phone venders. Currently, MPS supports Huawei, Xiaomi, OPPO, and vivo push channels. For how to access the push channels of those vendors, see Integrate third-party channels.

  • A notification will be sent automatically when the third-party channel receives the message. The users can click on the notification to open the Web page. If you need to jump to the in-app page according to a customized DeepLink, or customize the behavior after receiving the message, see Process notification click.

For more functions, see Advanced functions.

Sample code

Click here to download the sample code.

What to do next

After you successfully integrate MPS to your Android client, you can call the RESTful interface through the server. For more information, see Configure server > Push messages.