OPPO channel integration

更新时间:
复制 MD 格式

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

Preparations

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

  • You have registered your application on the OPPO open platform. If your application is not registered, log on to the platform and register it with the push service. Then, go to Configuration Management > Application Configuration to obtain the AppKey, AppSecret, and MasterSecret.

  • You have configured the OPPO push keys (AppKey and MasterSecret) in the Enterprise Mobile Application Studio (EMAS) console. If not, log on to the EMAS Mobile Push console to configure them. For more information, see Configure third-party channel keys.

Step 1: Add the SDK to your application

In your module-level Gradle file, which is usually <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-oppo:x.x.x'
}
Note

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

Step 2: Configure the SDK

1. SDK initialization

Important

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

Initialize the SDK as follows:

// Register the OPPO channel.
// Obtain the appKey and appSecret from the OPPO developer platform.
OppoRegister.register(applicationContext, appKey, appSecret)
// Register the OPPO channel.
// Obtain the appKey and appSecret from the OPPO developer platform.
OppoRegister.register(applicationContext, appKey, appSecret);
Note

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

2. Obfuscation configuration

If you enable code obfuscation for your project, add the following ProGuard configuration for the third-party channel.

# OPPO channel
-keep public class * extends android.app.Service

Step 3: Verify the integration

1. Enable SDK logs

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

2 Verification method

To verify that the OPPO channel registration is successful, filter the logs for the MPS:OPush keyword. A successful registration generates a log entry that contains `onRegister regid=**`. If the registration fails, verify that you entered the parameters correctly.

What to do next

You can now send push notifications to the notification bar through the third-party channel from the EMAS console. To process the logic after a user taps a notification, you must use a pop-up window to receive the push data. For more information, see Pop-up window integration.

Important
  • When you send push notifications through a third-party channel from the Mobile Push console or using OpenAPI, you must configure the server-side parameters as described in the pop-up window documentation. If these server-side parameters are not set, notifications will not be sent through the third-party channel.

Third-party channel FAQ

Troubleshoot third-party channel and pop-up window issues on Android

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

Tapping a notification received through a third-party channel on Android does not open the corresponding activity

An exception is reported for body parsing when the pop-up window starts on Android

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

OPPO platform push FAQ