All Products
Search
Document Center

Mobile Platform as a Service:Client APIs

Last Updated:Feb 10, 2026

Mobile Push Service (MPS) provides the following client APIs.

Call method

API

Description

RPC call

Bind

Binds a user ID and a device ID (Ad-token).

Unbind

Unbinds a user ID and a device ID (Ad-token).

Report third-party channel device

Binds a third-party channel device ID (Ad-token).

The MPPush class in the mPaaS middle layer encapsulates all Mobile Push Service component APIs, such as bind, unbind, and third-party channel device reporting. The mobile gateway software development kit (SDK) implements the remote procedure calls (RPCs) for these API methods.

Bind

  • Method definition

    This method binds a user ID to a device ID. Once bound, you can push messages to specific users. Call this method in a subthread.

      public static ResultPbPB bind(Context ctx, String userId, String token)
  • Parameters

    Parameter

    Type

    Description

    ctx

    Context

    A non-empty Context.

    userId

    String

    A unique user identifier. This identifier does not need to be the actual ID from your user system, but it must have a one-to-one mapping to a user.

    token

    String

    The device ID issued by the Mobile Push Service gateway.

  • Return value

    Parameter

    Description

    success

    Indicates whether the API call is successful.

    • true: The call is successful.

    • false: The call failed.

    code

    The result code of the operation. For common result codes and their descriptions, see the following table.

    name

    The name of the operation result code.

    message

    The description of the operation result code.

    Result code description

    Result code

    Result code name

    Message

    Description

    3012

    NEED_USERID

    need userid

    The input parameter userId is empty.

    3001

    NEED_DELIVERYTOKEN

    need token

    The input parameter token is empty.

  • Example

      private void doSimpleBind() {
          final ResultPbPB resultPbPB = MPPush.bind(getApplicationContext(), mUserId, PushMsgService.mAdToken);
          handlePbPBResult("Bind user operation", resultPbPB);
      }

Unbind

  • Method definition

    This method unbinds a user ID from a device ID. Call this method in a subthread.

    public static ResultPbPB unbind(Context ctx, String userId, String token)
  • Parameters

    Parameter

    Type

    Description

    ctx

    Context

    A non-empty Context.

    userId

    String

    A unique user identifier. This identifier does not need to be the actual ID from your user system, but it must have a one-to-one mapping to a user.

    token

    String

    The device ID issued by the Mobile Push Service gateway.

  • Return value

    This method returns the same value as the bind method.

  • Example

      private void doSimpleUnBind() {
          final ResultPbPB resultPbPB = MPPush.unbind(getApplicationContext()
                  , mUserId, PushMsgService.mAdToken);
          handlePbPBResult("Unbind user operation", resultPbPB);
      }

Report third-party channel device

  • Method definition

    This method reports the third-party channel device ID and the mPaaS device ID (the Ad-token issued by the Mobile Push Service gateway) to the Mobile Push Service core. The Mobile Push Service core then synchronously binds these two identifiers. After the binding is complete, you can push messages through the third-party channel.

    The framework calls this method internally. To prevent potential SDK call failures, you should call this method again manually.

      public static ResultPbPB report(Context context, String deliveryToken, int thirdChannel, String thirdChannelDeviceToken)
  • Parameters

    Parameter

    Type

    Description

    ctx

    Context

    A non-empty Context.

    deliveryToken

    String

    The device ID (Ad-token) issued by the Mobile Push Service gateway.

    thirdChannel

    int

    The third-party channel. The enumeration values are as follows:

    • 2: Apple

    • 4: Xiaomi

    • 5: Huawei

    • 6: FCM

    • 7: OPPO

    • 8: vivo

    thirdChannelDeviceToken

    String

    Device ID of the vendor channel

  • Return value

    This method returns the same value as the bind method.

  • Example

      private void doSimpleUploadToken() {
          final ResultPbPB resultPbPB = MPPush.report(getApplicationContext(), PushMsgService.mAdToken
                  , PushOsType.HUAWEI.value(), PushMsgService.mThirdToken);
          handlePbPBResult("Third-party push identifier reporting operation", resultPbPB);

Troubleshooting

If an exception occurs during an RPC resource call, see Security Guard result code description to troubleshoot the issue.