Meizu channel integration

更新时间:
复制 MD 格式

This topic describes how to integrate the Meizu channel software development kit (SDK) for Mobile Push.

Preparations

  • You have integrated the Mobile Push SDK as described in Android SDK Integration.

  • Register your application on the Meizu Open Platform. If you have not already registered, log on to the Meizu Open Platform and register your application with the Meizu push service. You can then obtain the AppID and AppSecret from your application's information.

  • Set up message receipts. To do this, find your application in the application list on the Meizu push platform. Click the application to open its details, and then go to the Configuration Management > Receipt Management page.

    image

    Important
    • Set the receipt address to http://amspush-ack.aliyuncs.com/mz/ and https://amspush-ack.aliyuncs.com/mz/. If you do not set the address, you may not receive push messages.

    • If you do not set up message receipts, you will not receive pushes through the Meizu channel.

  • Configure the Meizu push key (AppID and AppSecret) in the EMAS console. To do this, log on to the Mobile Push console and set your Meizu push key. For more information, see Configure third-party channel keys.

Step 1: Add the SDK to your application

In your module-level `build.gradle` file, which is typically located at <project>/<app-module>/build.gradle, add the SDK dependency to the dependencies block.

Important
dependencies {
    implementation 'com.aliyun.ams:alicloud-android-third-push:x.x.x'
    implementation 'com.aliyun.ams:alicloud-android-third-push-meizu:x.x.x'
}
Note

The Mobile Push third-party channel SDK only supports Maven dependencies.

Step 2: Configure the SDK

1. Initialize the SDK

Important

You must initialize the SDK in the `Application` class after you initialize the Mobile Push SDK. Otherwise, registration with the Meizu channel may fail.

Initialize the SDK as follows:

// Register with the Meizu channel
// Obtain the appId and appKey from the Meizu developer platform
MeizuRegister.register(applicationContext, "appId", "appkey")
// Register with the Meizu channel
// Obtain the appId and appKey from the Meizu developer platform
MeizuRegister.register(applicationContext, "appId", "appkey");
Note

The registration method automatically checks if the device supports Meizu system push. If not, the registration is skipped.

2. Configure obfuscation

If code obfuscation is enabled for a project that integrates the push SDK, you need to add the following ProGuard configurations for the vendor channels.

# Meizu channel
-keep class com.meizu.cloud.** {*;}
-dontwarn com.meizu.cloud.**

Step 3: Verify the integration

1. Enable SDK logs

val pushService = PushServiceFactory.getCloudPushService()
// This line is for debug packages only. It is not needed for release packages.
pushService.setLogLevel(CloudPushService.LOG_DEBUG)
CloudPushService pushService = PushServiceFactory.getCloudPushService();
// This line is for debug packages only. It is not needed for release packages.
pushService.setLogLevel(CloudPushService.LOG_DEBUG);      

2 Confirmation method

After the Meizu channel is successfully initialized, the following logs are displayed:

What to do next

You can push notifications to the notification bar through vendor channels from the EMAS console, but handling the logic after a user clicks a notification requires using an auxiliary pop-up window to receive the push data. For more information, see Auxiliary Pop-up Window Integration.

Important
  • When you send pushes through a third-party channel using the EMAS console or OpenAPI, you must configure the server-side parameters as described in the auxiliary pop-up window documentation. If these parameters are not set, messages cannot be delivered through the third-party channel.

Vendor Channel FAQ

Pushes cannot be sent through the Meizu channel if you do not set up message receipts.

Troubleshooting steps for Android third-party channel and pop-up window issues

Conflicts between the Android third-party channel SDK and other third-party SDKs

Tapping a notification received through the Android third-party channel fails to open the corresponding Activity

The auxiliary pop-up window on Android reports a body parsing error upon startup

The message "register not in main process, return" is displayed after integrating the Mobile Push third-party channel