Manufacturer Channel SDK Integration Guide
This document aims to guide customers in integrating the SDKs of various manufacturer channels using an automated integration method to achieve offline push notifications.
For SDK download, refer to Resource Download. For the latest SDK version number, refer to Changelog.
Prerequisites
- Engagelab channel has already been integrated.
- Before integrating the manufacturer's SDK, you need to apply for the relevant manufacturer channel parameters. Please refer to the Manufacturer Channel Parameter Application Guide for details.
Resource Files
- Place the notification icon named
mtpush_notification_icon.png
underres/drawable/
. If not configured, the SDK will use the application icon, and higher versions of Android may have display issues.
Xiaomi Channel Integration Guide
Configure mavenCentral Support
Configure mavenCentral support in the main gradle file of the Project root directory. (New projects are typically configured with this support by default.)
buildscript {
repositories {
mavenCentral()
}
}
allprojects {
repositories {
mavenCentral()
}
}
Configure Dependencies
In the dependencies
section of the application module's gradle
file, add the following code:
dependencies {
// The manufacturer version should match the Engagelab SDK version
implementation 'com.engagelab.plugin:mi:5.x.x'
}
Configure Parameters
In the defaultConfig
section of the application module's gradle
file, add the following code:
manifestPlaceholders = [
// Set variables in the manifest.xml file
XIAOMI_APPKEY : "MI-Your Xiaomi app's APPID", // Xiaomi platform registered appkey
XIAOMI_APPID : "MI-Your Xiaomi app's APPKEY", // Xiaomi platform registered appid
]
Configure Code Obfuscation
If using proguard, add the following content to the configuration file to prevent false warning reports from preventing successful compilation:
-dontwarn com.xiaomi.push.**
-keep class com.xiaomi.push.** { *; }
Integration Success Validation
If integration is successful, the log will display the following:
D [MTMiBusiness] support xiaomi push
D [MTMiBusiness] onTokenSuccess:get token is Tv3KBknVcnEaXnLe89MGEH3SWVgUYdLDYzJaST30IoIGATl2tv5eu6iuT/PTO0Mj
D [MTPlatformBusiness] onPlatformTokenSuccess, rid:5, platformToken:
{
platform=1,
token=Tv3KBknVcnEaXnLe89MGEH3SWVgUYdLDYzJaST30IoIGATl2tv5eu6iuT/PTO0Mj
region=NULL
isUserSettings=false
}
Xiaomi Channel Testing Method
- Go to the [EngageLab Console] -> [AppPush] -> [Basic Settings] -> [Integration Settings] page, enter the parameters: AppKey, AppID, AppSecret, and click "Save".
- After killing the app process, perform a push. If the push is received, the manufacturer channel integration is successful.
Special Notes for Xiaomi Android 13 and Above
According to Xiaomi’s official documentation, Android 13 and above require the application launch method to precisely match the Intent filter to ensure proper application behavior on Xiaomi devices.
Please refer to Google’s official documentation for more details on Intent filters in Android 13 and above: Google Official Documentation - Intent Filters
Developer Testing Recommendations:
Developers can check the "Application Compatibility Changes" in the developer options on Xiaomi devices and enable the ENFORCE_INTENTS_TO_MATCH_INTENT_FILTERS option during testing to ensure the app works correctly in all cases.
Huawei Channel Integration Guide
Configure mavenCentral Support
Configure mavenCentral support and agconnect dependency in the main gradle file of the Project root directory.
buildscript {
repositories {
google()
mavenCentral()
maven {url 'https://developer.huawei.com/repo/'}
}
}
buildscript {
dependencies {
classpath 'com.huawei.agconnect:agcp:1.6.0.300'
}
}
allprojects {
repositories {
google()
mavenCentral()
maven {url 'https://developer.huawei.com/repo/'}
}
}
(Optional) If using gradle 8.0, add the following command to the project-level gradle.properties
file:
Note: Integrating versions of the AGC plugin lower than 1.9.1.300 does not support gradle 8.0 compatibility. You need to execute this step.
apmsInstrumentationEnabled=false
Add Huawei Plugin
Add the following line to the bottom of the application module’s build.gradle
file to enable the gradle plugin:
apply plugin: 'com.huawei.agconnect'
Configure Dependencies
In the dependencies
section of the application module’s gradle
file, add the following code, selecting the latest version based on Huawei's release:
dependencies {
implementation 'com.huawei.hms:push:6.11.0.300'
// The manufacturer version should match the AppPush SDK version
implementation 'com.engagelab.plugin:huawei:5.x.x'
}
Configure agconnect-services.json File
Refer to the Manufacturer Channel Parameter Application Guide to get the agconnect-services.json
file and configure it in the app
directory.
Configure Signature Certificate
In the build.gradle
file, configure the signature corresponding to the fingerprint certificate added in the Huawei backend.
The HMS service requires the app to be signed for successful registration. You can get the corresponding fingerprint certificate by using the command
keytool -list -v -keystore keystorefileName
.
signingConfigs {
release {
storeFile file("release.keystore") // Path to the signature file
storePassword "123456"
keyAlias "android.keystore"
keyPassword "123456"
}
}
buildTypes {
release {
minifyEnabled true
proguardFiles 'proguard-rules.pro'
signingConfig signingConfigs.release
}
debug{
minifyEnabled false
signingConfig signingConfigs.release
}
}
Configure Code Obfuscation
If using proguard, add the following content to the configuration file to prevent false warning reports from preventing successful compilation:
-ignorewarnings
-keepattributes *Annotation*
-keepattributes Exceptions
-keepattributes InnerClasses
-keepattributes Signature
-keepattributes SourceFile,LineNumberTable
-keep class com.hianalytics.android.**{*;}
-keep class com.huawei.updatesdk.**{*;}
-keep class com.huawei.hms.**{*;}
If you are using AndResGuard, add the AndResGuard whitelist to the obfuscation configuration file.
"R.string.hms*",
"R.string.connect_server_fail_prompt_toast",
"R.string.getting_message_fail_prompt_toast",
"R.string.no_available_network_prompt_toast",
"R.string.third_app_*",
"R.string.upsdk_*",
"R.layout.hms*",
"R.layout.upsdk_*",
"R.drawable.upsdk*",
"R.color.upsdk*",
"R.dimen.upsdk*",
"R.style.upsdk*",
"R.string.agc*"
Integration Success Validation
If integration is successful, the log will display the following:
D [MTHuaweiBusiness] support huawei push
D [MTHuaweiBusiness] onTokenSuccess:get token is IQAAAACy0aL1AABEZ3l2C7jluCGX5XriooCvoOwK9TrjG1MTpH0CD47WPXFcAbtt3DdOeOPvX6d7xfAVctoyaOCGKRllRa-0RBP7WQrYI6SxnOp1GA
D [MTPlatformBusiness] onPlatformTokenSuccess, rid:5, platformToken:
{
platform=2,
token=IQAAAACy0aL1AABEZ3l2C7jluCGX5XriooCvoOwK9TrjG1MTpH0CD47WPXFcAbtt3DdOeOPvX6d7xfAVctoyaOCGKRllRa-0RBP7WQrYI6SxnOp1GA
region=NULL
isUserSettings=false
}
Huawei Channel Testing Method
- Go to the [EngageLab Console] -> [AppPush] -> [Basic Settings] -> [Integration Settings] page, enter the parameters: AppID, AppSecret, and click "Save".
2. After killing the app process, perform a push. If the push is received, the manufacturer channel integration is successful.
Meizu Channel Integration Guide
Configure mavenCentral Support
In the main gradle file of the Project root directory, configure mavenCentral support. (New projects are typically configured with this support by default.)
buildscript {
repositories {
mavenCentral()
}
}
allprojects {
repositories {
mavenCentral()
}
}
Configure Dependencies
In the dependencies
section of the application module's gradle
file, add the following code:
dependencies {
// The manufacturer version should match the AppPush SDK version
implementation 'com.engagelab.plugin:meizu:5.x.x'
}
Configure Parameters
In the defaultConfig
section of the application module's gradle
file, add the following code:
The parameters for Meizu need to be prefixed with "MZ-".
manifestPlaceholders = [
// Set variables in the manifest.xml file
MEIZU_APPKEY : "MZ-Your Meizu app's APPKEY", // Meizu platform registered appkey
MEIZU_APPID : "MZ-Your Meizu app's APPID", // Meizu platform registered appid
]
Configure Code Obfuscation
If using proguard, add the following content to the configuration file to prevent false warning reports from preventing successful compilation:
-dontwarn com.meizu.cloud.**
-keep class com.meizu.cloud.** { *; }
Integration Success Validation
If integration is successful, the log will display the following:
D [MTMeizuBusiness] support meizu push
D [MTPlatformBusiness] onPlatformTokenSuccess, rid:5, platformToken:
{
platform=3,
token=DDI5c060475064d447b40670206756d73605705037205
region=NULL
isUserSettings=false
}
If Meizu channel cannot obtain the token, try adding android.enableR8 = false
in the gradle.properties
to disable R8.
Meizu Manufacturer Testing Method
Go to the [EngageLab Console] -> [AppPush] -> [Basic Settings] -> [Integration Settings] page, enter the parameters: AppKey, AppID, AppSecret, and click "Save".
After killing the app process, perform a push. If the push is received, the manufacturer channel integration is successful.
Vivo Channel Integration Guide
Configure mavenCentral Support
In the main gradle file of the Project root directory, configure mavenCentral support. (New projects are typically configured with this support by default.)
buildscript {
repositories {
mavenCentral()
}
}
allprojects {
repositories {
mavenCentral()
}
}
Configure Dependencies
In the dependencies
section of the application module's gradle
file, add the following code:
dependencies{
// The manufacturer version should match the AppPush SDK version
implementation 'com.engagelab.plugin:vivo:5.x.x'
}
Configure Parameters
In the defaultConfig
section of the application module's gradle
file, add the following code:
manifestPlaceholders=[
VIVO_APPKEY : "Your Vivo app's APPKEY", // Vivo platform registered appkey
VIVO_APPID : "Your Vivo app's APPID", // Vivo platform registered appid
]
Integration Success Validation
If integration is successful, the log will display the following:
D [MTVivoBusiness] support vivo push
D [MTVivoBusiness] getRegId onTokenSuccess:get token is v2-CRrhwCeK9eY77H6m_EeUqz3zGqmbh0LJPnhvsF0V-ia9OmMHQP9FGCjZ
D [MTPlatformBusiness] onPlatformTokenSuccess, rid:5, platformToken:
{
platform=5,
token=v2-CRrhwCeK9eY77H6m_EeUqz3zGqmbh0LJPnhvsF0V-ia9OmMHQP9FGCjZ
region=NULL
isUserSettings=false
}
Configure Code Obfuscation
If using proguard, add the following content to the configuration file to prevent false warning reports from preventing successful compilation:
-dontwarn com.vivo.push.**
-keep class com.vivo.push.**{*; }
-keep class com.vivo.vms.**{*; }
Vivo Channel Testing Method
- Go to the [EngageLab Console] -> [AppPush] -> [Basic Settings] -> [Integration Settings] page, enter the parameters: AppKey, AppID, AppSecret, and click "Save".
2. After killing the app process, perform a push. If the push is received, the manufacturer channel integration is successful.
If Vivo is not available on the market, when testing the push, you need to add the test device in the Vivo push platform and only send the push using the API with the
push_mode
specified.
"options": {
"classification": 1,
"third_party_channel": {
"vivo": {
"pushMode": 1, // Optional, added on 2020/09/21. Corresponding to Vivo’s pushMode field, the integer values are: “0” for formal push; “1” for test push, default is 0
"distribution_new": "pns_mtpush"
}
}
}
OPPO Channel Integration Guide
Configure mavenCentral Support
In the main gradle file of the Project root directory, configure mavenCentral support. (New projects are typically configured with this support by default.)
buildscript {
repositories {
mavenCentral()
}
}
allprojects {
repositories {
mavenCentral()
}
}
Configure Dependencies
In the dependencies
section of the application module's gradle
file, add the following code:
dependencies{
// The manufacturer version should match the AppPush SDK version
implementation 'com.engagelab.plugin:oppo:5.x.x'
implementation 'com.engagelab.plugin:oppo_th_push:5.x.x'
// OPPO requires the following dependencies to be added
implementation 'com.google.code.gson:gson:2.8.9'
implementation 'commons-codec:commons-codec:1.13'
implementation 'androidx.annotation:annotation:1.1.0'
}
Configure Parameters
In the defaultConfig
section of the application module's gradle
file, add the following code:
OPPO's parameters need to be prefixed with "OP-".
manifestPlaceholders=[
OPPO_APPKEY : "OP-Your OPPO app's APPKEY", // OPPO platform registered appkey
OPPO_APPID : "OP-Your OPPO app's APPID", // OPPO platform registered appid
OPPO_APPSECRET: "OP-Your OPPO app's APPSECRET" // OPPO platform registered appsecret
]
Configure Code Obfuscation
If using proguard, add the following content to the configuration file to prevent false warning reports from preventing successful compilation:
-dontwarn com.coloros.mcsdk.**
-keep class com.coloros.mcsdk.** { *; }
-dontwarn com.heytap.**
-keep class com.heytap.** { *; }
-dontwarn com.mcs.**
-keep class com.mcs.** { *; }
Integration Success Validation
If integration is successful, the log will display the following:
D [MTOppoBusiness] support oppo push
D [MTOppoBusiness] onTokenSuccess:get token is OnePlus_CN_0e3c2f966c9d01d4e2423cbc9e7598b6
D [MTPlatformBusiness] onPlatformTokenSuccess, rid:5, platformToken:
{
platform=4,
token=OnePlus_CN_0e3c2f966c9d01d4e2423cbc9e7598b6
region=NULL
isUserSettings=false
}
OPPO Channel Testing Method
- Go to the [EngageLab Console] -> [App
Push] -> [Basic Settings] -> [Integration Settings] page, enter the parameters: AppKey, AppID, AppSecret, MasterSecret, and click "Save".
2. After killing the app process, perform a push. If the push is received, the manufacturer channel integration is successful.
If the app is not available, testing requires applying for push test permission on the OPPO open platform. Each app can push 1000 public messages per day.
FCM Channel Integration Guide
Configure mavenCentral Support
In the main gradle file of the Project root directory, configure mavenCentral support and google-services dependency.
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.google.gms:google-services:4.3.15'
}
}
allprojects {
repositories {
mavenCentral()
maven { url "https://maven.google.com" }
}
}
Add FCM Plugin
At the bottom of the application module's build.gradle
file, add the following line to enable the gradle plugin:
apply plugin: 'com.google.gms.google-services'
Configure Dependencies
In the dependencies
section of the application module’s gradle
file, add the following code:
dependencies {
// The manufacturer version should match the AppPush SDK version
implementation 'com.engagelab.plugin:google:5.x.x'
implementation 'com.google.firebase:firebase-messaging:23.2.0'
}
In the android
section of the application module's gradle
file, add the following code:
android {
// google push need java 1.8
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
Configure google-services.json File
Refer to the Manufacturer Channel Parameter Application Guide to get the google-services.json
file and configure it in the app
directory.
Configure FCM Notification Icon
Add the following configuration to the AndroidManifest.xml file to set the FCM notification icon.
<meta-data android:name="com.google.firebase.messaging.default_notification_icon"
android:resource="@drawable/Your notification icon" />
Integration Success Validation
If integration is successful, the log will display the following:
D [MTGoogleBusiness] support google push
D [MTPlatformBusiness] onPlatformTokenSuccess, rid:5, platformToken:
{
platform=8,
token=dj793yH_RO6FqNyKImQJYV:APA91bExj3PSVv50pwtl83LXVeB_HKOCSkyB6qCE12TIwIRl-RKiqCfXjvCshcqVrqn_8htlNBa8_A_8ixq7YIxfrloxig2BryZPCkunyx_z2drz0L-C2K8R7J8Yrojs61WCsF-BZj8h
region=NULL
isUserSettings=false
}
FCM Channel Testing Method
- Testing Preconditions:
- The phone's system must have Google Play services, version 17.3.4 or above.
- Testing requires connecting to an overseas VPN and ensuring the phone network can access Google.
- If using a domestic phone for testing, the app must remain in the background; testing will fail if the app is closed, as domestic manufacturers may kill the process in the background.
Go to the [EngageLab Console] -> [AppPush] -> [Basic Settings] -> [Integration Settings] page, enter the parameters: App Secret, and click "Save".
If testing in China, you need to set the country code after initialization.
public class ExampleApplication extends Application {
@Override
public void onCreate() {
super.onCreate();
MTCorePrivatesApi.configDebugMode(this, true);
// Set country code -- Do not set this in the production environment
MTGlobal.setCountryCode("US");
// Initialize
MTPushPrivatesApi.init(this);
}
}
- In the AppPush backend, check whether the push was sent through the FCM channel or Engagelab channel.
Honor Channel Integration Guide
Configure mavenCentral Support
In the main gradle file of the Project root directory, configure mavenCentral support. (New projects are typically configured with this support by default.)
buildscript {
repositories {
...
mavenCentral()
...
}
}
allprojets {
repositories {
...
mavenCentral()
...
}
}
Configure Parameters and Dependencies
In the build.gradle
file of the project module, add the following code:
defaultConfig {
...
manifestPlaceholders = [
...
HONOR_APPID : "Your Honor app's APP ID", // Honor platform registered APP ID
...
]
...
}
dependencies {
...
// The manufacturer version should match the AppPush SDK version
implementation 'com.engagelab.plugin:honor:5.x.x'
implementation 'com.engagelab.plugin:honor_th_push:5.x.x'
...
}
Configure Signature Certificate
In the build.gradle
file, configure the signature corresponding to the fingerprint certificate added in the Honor backend.
The Honor service requires the app to be signed for successful registration. You can get the corresponding fingerprint certificate by using the command
keytool -list -v -keystore <path to the keystore file>
.
Integration Success Validation
If integration is successful, the log will display the following:
D [MTHonorBusiness] support honor push
D [MTHonorBusiness] onTokenSuccess:get token is s18069ps301291893q1ssro2o40s1630-n262n542r9669q62o83s390306179rro-775875632-654-6105326555582-PA-0052993947080949113-5
D [MTPlatformBusiness] onPlatformTokenSuccess, rid:5, platformToken:
{
platform=7,
token=s18069ps301291893q1ssro2o40s1630-n262n542r9669q62o83s390306179rro-775875632-654-6105326555582-PA-0052993947080949113-5
region=NULL
isUserSettings=false
}
Configure Code Obfuscation
If using proguard, add the following content to the configuration file to prevent false warning reports from preventing successful compilation:
-ignorewarnings
-keepattributes *Annotation*
-keepattributes Exceptions
-keepattributes InnerClasses
-keepattributes Signature
-keepattributes SourceFile,LineNumberTable
-keep class com.hihonor.push.**{*;}
Honor Channel Testing Method
- Go to the [EngageLab Console] -> [AppPush] -> [Basic Settings] -> [Integration Settings] page, enter the parameters: App ID, Client ID, Client Secret, App Secret, and click "Save".
- After killing the app process, perform a push. If the push is received, the manufacturer channel integration is successful.
How to Report Manufacturer Notifications Without Integrating the Manufacturer SDK but Still Use EngageLab to Push Manufacturer Messages
/**
* Report manufacturer channel notification arrival
*
* Report via http/https
*
* @param context Not null
* @param messageId EngageLab message id, not null
* @param platform Manufacturer, values range (1:mi, 2:huawei, 3:meizu, 4:oppo, 5:vivo, 8:google)
* @param platformMessageId Manufacturer message id, can be null
*/
public static void reportNotificationArrived(Context context, String messageId, byte platform, String platformMessageId)
/**
* Report manufacturer channel notification click
*
* Report via http/https
*
* @param context Not null
* @param messageId EngageLab message id, not null
* @param platform Manufacturer, values range (1:mi, 2:huawei, 3:meizu, 4:oppo, 5:vivo, 7:honor, 8:google)
* @param platformMessageId Manufacturer message id, can be null
*/
public static void reportNotificationClicked(Context context, String messageId, byte platform, String platformMessageId)
/**
* Report manufacturer channel notification deletion
*
* Report via http/https
*
* @param context Not null
* @param messageId EngageLab message id, not null
* @param platform Manufacturer, values range (1:mi, 2:huawei, 3:meizu, 4:oppo, 5:vivo, 7:honor, 8:google)
* @param platformMessageId Manufacturer message id, can be null
*/
public static void reportNotificationDeleted(Context context, String messageId, byte platform, String platformMessageId)
/**
* Report manufacturer channel notification open
*
* Report via http/https
*
* @param context Not null
* @param messageId EngageLab message id, not null
* @param platform Manufacturer, values range (1:mi, 2:huawei, 3:meizu, 4:oppo, 5:vivo, 7:honor, 8:google)
* @param platformMessageId Manufacturer message id, can be null
*/
public static void reportNotificationOpened(Context context, String messageId, byte platform, String platformMessageId)
/**
* Upload manufacturer token
*
* Must be called after EngageLab long connection is successfully established, otherwise invalid. The long connection status is successfully established when `MTCommonReceiver.onConnectStatus` callback returns true.
*
* Upload via TCP
*
* @param context Not null
* @param platform Manufacturer, values range (1:mi, 2:huawei, 3:meizu, 4:oppo, 5:vivo, 7:honor, 8:google)
* @param token Manufacturer returned token, not null
*/
public static void uploadPlatformToken(Context context, byte platform, String token)