vivo channel integration

更新时间:
复制 MD 格式

This topic describes how to integrate the vivo channel SDK for Mobile Push.

Preparations

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

  • You have registered your application on the vivo Open Platform. If not, log on to the vivo Open Platform to register your application. In the application information, obtain the AppID, AppKey, and AppSecret.

  • You have set up message receipts. If not, go to the Push Service section on the vivo Open Platform. In the information for the application that you want to configure, enable "APP Callback Address".

    Important
    • If the app callback address is not enabled, Mobile Push can only count arrivals and cannot detect push failures or their causes. We recommend that you enable this feature.

    • Set the callback address to https://amspush-ack.aliyuncs.com/vivo/.

    • The callback address takes effect one hour after it is added. If you configure a callback address for an existing app that did not previously have one, statistics may not be collected for a period of time.

    • After you configure the callback address, record the callback ID from the interface and configure it in the Mobile Push console.

  • You have configured the vivo push key (AppID, AppSecret, and default callback ID) in the EMAS console. If not, log on to the EMAS Mobile Push console to set your vivo push key. 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 typically <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-vivo:x.x.x'
}
Note

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

Step 2: Configure the SDK

1. Configure the AppID and AppKey

In the application node of your app-level AndroidManifest.xml file, add metadata to configure the AppID and AppKey.

<meta-data
    android:name="com.vivo.push.api_key"
    android:value="Enter the AppKey of your application registered on the vivo platform" />
<meta-data
    android:name="com.vivo.push.app_id"
    android:value="Enter the AppID of your application registered on the vivo platform" />

2. Initialize the SDK

Important

Initialize the SDK in the `Application` class. Place the initialization code after the Mobile Push SDK initialization code. Otherwise, channel registration may fail.

Initialize the SDK as follows:

// Register the vivo channel
VivoRegister.register(applicationContext)
// Register the vivo channel
VivoRegister.register(applicationContext);
Note

The registration method automatically checks if the system supports vivo push. If not, it skips registration.

3. Configure obfuscation

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

# vivo channel
-keep class com.vivo.** {*;}
-dontwarn com.vivo.**

Step 3: Verify the integration

1. Enable SDK logging

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 Verification method

To check if the vivo channel registered successfully, filter logs for the MPS:vPush keyword. A successful registration generates a log entry that contains `getRegId regId:**`. If it fails, verify that your parameters are correct.

What to do next

You can now push notifications to the device's notification bar through the vivo channel from the EMAS console. To handle the logic after a user taps a notification, you must use an auxiliary pop-up window to receive the push data. For more information, see Integrate an auxiliary pop-up window.

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

Third-party channel FAQ

After an application is installed on a vivo device, notification permissions are not granted by default. Guide users to enable these permissions manually.

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

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

Tapping a notification from an Android third-party channel fails to open the corresponding activity

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

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