Manufacturer Channel Integration Guide

最新の更新:2022-12-13

The premise is that the Engagelab channel has been integrated.

sdb libs import package and resource file

  • Import mt sdk platform x.x.x.aar into the libs directory
  • Make sure notification small icon name is mtpush_notification_icon.png. And then put it into 'res/drawable/' directory. If the icon file does not exists, the sdk will not read the application icon file, and the higher version of android will display abnormally.
  • For more information about how to apply for manufacturer channel parameter infomations and how to obtain manufacturer files, see Application Guide for Manufacturer Channel Parameters.
    • huawei Channel requirements agconnect-services.json file, which is configured in the module directory of the application.
    • google Channel requirements google-services.json file, which is configured in the module directory of the application.
  • If can not get the meizu channel token, try to add 'android EnableR8=false' to close R8 in the gradle.properties.

Configuration of build.gradle

// Top-level build file where you can add configuration options common to all sub-projects/modules. buildscript { repositories { google() mavenCentral() // huawei push need,if the huawei channel is not required, delete it maven { url 'https://developer.huawei.com/repo/' } // oppo push need,huawei push need,if the oppo channel is not required, delete it maven { url 'https://maven.columbus.heytapmobi.com/repository/releases/' credentials { username 'nexus' password 'c0b08da17e3ec36c3870fed674a0bcb36abc2e23' } } maven {url 'http://nexus.os.adc.com/nexus/content/groups/public'} } dependencies { classpath 'com.android.tools.build:gradle:4.1.0' // google push need,if the google channel is not required, delete it // Please add android.useAndroidX=true to gradle.properties classpath 'com.google.gms:google-services:4.3.15' // huawei push need,if the huawei channel is not required, delete it classpath 'com.huawei.agconnect:agcp:1.6.0.300' } } allprojects { repositories { google() mavenCentral() // huawei push need,if the huawei channel is not required, delete it maven { url 'https://developer.huawei.com/repo/' } // oppo push need,huawei push need,if the oppo channel is not required, delete it maven { url 'https://maven.columbus.heytapmobi.com/repository/releases/' credentials { username 'nexus' password 'c0b08da17e3ec36c3870fed674a0bcb36abc2e23' } } maven {url 'http://nexus.os.adc.com/nexus/content/groups/public'} } }
          // Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
  repositories {
    google()
    mavenCentral()
    // huawei push need,if the huawei channel is not required, delete it
    maven { url 'https://developer.huawei.com/repo/' }
    // oppo push need,huawei push need,if the oppo channel is not required, delete it
    maven {
        url 'https://maven.columbus.heytapmobi.com/repository/releases/'
        credentials {
            username 'nexus'
            password 'c0b08da17e3ec36c3870fed674a0bcb36abc2e23'
        }
    }
      maven {url 'http://nexus.os.adc.com/nexus/content/groups/public'}
  }
  dependencies {
    classpath 'com.android.tools.build:gradle:4.1.0'
    // google push need,if the google channel is not required, delete it
    // Please add android.useAndroidX=true to gradle.properties
    classpath 'com.google.gms:google-services:4.3.15'
    // huawei push need,if the huawei channel is not required, delete it
    classpath 'com.huawei.agconnect:agcp:1.6.0.300'
  }
}

allprojects {
  repositories {
    google()
    mavenCentral()
    // huawei push need,if the huawei channel is not required, delete it
    maven { url 'https://developer.huawei.com/repo/' }
    // oppo push need,huawei push need,if the oppo channel is not required, delete it
    maven {
        url 'https://maven.columbus.heytapmobi.com/repository/releases/'
        credentials {
            username 'nexus'
            password 'c0b08da17e3ec36c3870fed674a0bcb36abc2e23'
        }
    }
    maven {url 'http://nexus.os.adc.com/nexus/content/groups/public'}
  }
}

        
このコードブロックは、フローティングウィンドウに表示されます
plugins { id 'com.android.application' // google push need,If the google channel is not required, delete it id 'com.google.gms.google-services' // huawei push need,If the huawei channel is not required, delete it id 'com.huawei.agconnect' } android { ...... // google/huawei push need,it needs to be the same as the one on google/huawei console. signingConfigs { debug { storeFile file("android.keystore") storePassword "123456" keyAlias "keyAlias" keyPassword "123456" } release { storeFile file("android.keystore") storePassword "123456" keyAlias "keyAlias" keyPassword "123456" } } defaultConfig { // app packageName,It needs to be the same as that on the Engagelab console applicationId "com.engagelab.app" ...... manifestPlaceholders = [ // Engagelab appKey,It needs to be the same as that on the Engagelab console, and has a one-to-one relationship with packageName ENGAGELAB_PRIVATES_APPKEY : "1c4b749a17f6aca33960a560", // Engagelab appChannel,Used for channel statistics ENGAGELAB_PRIVATES_CHANNEL: "developer", // Engagelab process,The process where Engagelab sdk works. Note:the head ENGAGELAB_PRIVATES_PROCESS: ":remote", // The mi client configuration needs to be the same as that on the Xiaomi console, and the server configuration needs to be configured on the Engagelab console XIAOMI_APPID : "MI-2882303761519903247", XIAOMI_APPKEY : "MI-5511990317247", // The configuration of the mz client needs to be the same as that on the Meizu console, and the server configuration needs to be configured on the Engagelab console. MEIZU_APPID : "MZ-141044", MEIZU_APPKEY : "MZ-db66ddbf3caa49f5a3d61281b62f9172", // The oppo client configuration needs to be the same as that on the oppo console, and the server configuration needs to be configured on the Engagelab console. OPPO_APPID : "OP-30527975", OPPO_APPKEY : "OP-ccaa93f426af4b05b529bb4e2a3b368b", OPPO_APPSECRET : "OP-6da40dca7fd64279a6837ec899f2151d", //The vivo client configuration needs to be the same as that on the vivo console, and the server configuration needs to be configured on the Engagelab console. VIVO_APPID : "105481245", VIVO_APPKEY : "8ce86005c2bc8a4db5178210b51eeb8a" ] } // google push need java 1.8,If the Google channel is not required, delete it compileOptions { sourceCompatibility JavaVersion.VERSION_1_8 targetCompatibility JavaVersion.VERSION_1_8 } } dependencies { // import libs/aar packages implementation fileTree(include: ['*.jar', '*.aar'], dir: 'libs') // google push need,If the Google channel is not required, delete it // implementation 'com.google.firebase:firebase-messaging:23.2.0' // huawei push need,If the huawei channel is not required, delete it //implementation 'com.huawei.hms:push:6.11.0.300' //The following Oppo dependencies need to be added. If the Oppo channel is not needed, delete it // implementation 'com.google.code.gson:gson:2.8.9' // implementation 'commons-codec:commons-codec:1.13' // implementation 'androidx.annotation:annotation:1.1.0' }
          plugins {
    id 'com.android.application'
    // google push need,If the google channel is not required, delete it
    id 'com.google.gms.google-services'
    // huawei push need,If the huawei channel is not required, delete it
    id 'com.huawei.agconnect'
}

android {
    ......
        
    // google/huawei push need,it needs to be the same as the one on google/huawei console.
    signingConfigs {
        debug {
            storeFile file("android.keystore")
            storePassword "123456"
            keyAlias "keyAlias"
            keyPassword "123456"
        }
        release {
            storeFile file("android.keystore")
            storePassword "123456"
            keyAlias "keyAlias"
            keyPassword "123456"
        }
    }
        
    defaultConfig {
        // app packageName,It needs to be the same as that on the Engagelab console
        applicationId "com.engagelab.app"
                ......

        manifestPlaceholders = [
                // Engagelab appKey,It needs to be the same as that on the Engagelab console, and has a one-to-one relationship with packageName
                ENGAGELAB_PRIVATES_APPKEY : "1c4b749a17f6aca33960a560",
                // Engagelab appChannel,Used for channel statistics
                ENGAGELAB_PRIVATES_CHANNEL: "developer",
                // Engagelab process,The process where Engagelab sdk works. Note:the head
                ENGAGELAB_PRIVATES_PROCESS: ":remote",
                // The mi client configuration needs to be the same as that on the Xiaomi console, and the server configuration needs to be configured on the Engagelab console
                XIAOMI_APPID            : "MI-2882303761519903247",
                XIAOMI_APPKEY           : "MI-5511990317247",
                // The configuration of the mz client needs to be the same as that on the Meizu console, and the server configuration needs to be configured on the Engagelab console.
                MEIZU_APPID             : "MZ-141044",
                MEIZU_APPKEY            : "MZ-db66ddbf3caa49f5a3d61281b62f9172",
                // The oppo client configuration needs to be the same as that on the oppo console, and the server configuration needs to be configured on the Engagelab console.
                OPPO_APPID              : "OP-30527975",
                OPPO_APPKEY             : "OP-ccaa93f426af4b05b529bb4e2a3b368b",
                OPPO_APPSECRET          : "OP-6da40dca7fd64279a6837ec899f2151d",
                //The vivo client configuration needs to be the same as that on the vivo console, and the server configuration needs to be configured on the Engagelab console.
                VIVO_APPID              : "105481245",
                VIVO_APPKEY             : "8ce86005c2bc8a4db5178210b51eeb8a"
        ]
    }
        
    // google push need java 1.8,If the Google channel is not required, delete it
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }

}

dependencies {
    // import libs/aar packages
    implementation fileTree(include: ['*.jar', '*.aar'], dir: 'libs')

    // google push need,If the Google channel is not required, delete it
    // implementation 'com.google.firebase:firebase-messaging:23.2.0'

    // huawei push need,If the huawei channel is not required, delete it
    //implementation 'com.huawei.hms:push:6.11.0.300'
    
    
    //The following Oppo dependencies need to be added. If the Oppo channel is not needed, delete it
    //    implementation 'com.google.code.gson:gson:2.8.9'
    //    implementation 'commons-codec:commons-codec:1.13'
    //    implementation 'androidx.annotation:annotation:1.1.0'
    
}

        
このコードブロックは、フローティングウィンドウに表示されます

Do not import Engagelab SDK

If the application has been connected to the official SDK of the manufacturer before, and do not need to import mt-sdk-platform-x.x.aar. When calling the below report methods success, you can still use the Engagelab platform to push messages from the manufacturer.

Report the arrival of manufacturer channel notification

/** * Report the arrival of manufacturer channel notification * * Report via http/https * * @param context Not empty * @param messageId Engagelab message id, not empty * @param platform Manufacturer, value range(1:mi、2:huawei、3:meizu、4:oppo、5:vivo、8:google) * @param platformMessageId Manufacturer message ID, can be blank */ public static void reportNotificationArrived(Context context, String messageId, byte platform, String platformMessageId)
              /**
     * Report the arrival of manufacturer channel notification
     * 
     * Report via http/https
     *
     * @param context           Not empty
     * @param messageId         Engagelab message id, not empty
     * @param platform          Manufacturer, value range(1:mi、2:huawei、3:meizu、4:oppo、5:vivo、8:google)
     * @param platformMessageId Manufacturer message ID, can be blank
     */
    public static void reportNotificationArrived(Context context, String messageId, byte platform, String platformMessageId)

        
このコードブロックは、フローティングウィンドウに表示されます

Report notification of clicking manufacturer channel

/** * Report notification of clicking manufacturer channel * * Report via http/https * * @param context Not empty * @param messageId Engagelab message id, not empty * @param platform Manufacturer, value range(1:mi、2:huawei、3:meizu、4:oppo、5:vivo、8:google) * @param platformMessageId Manufacturer message ID, can be blank */ public static void reportNotificationClicked(Context context, String messageId, byte platform, String platformMessageId)
              /**
     * Report notification of clicking manufacturer channel
     * 
     * Report via http/https
     *
     * @param context           Not empty
     * @param messageId         Engagelab message id, not empty
     * @param platform          Manufacturer, value range(1:mi2:huawei3:meizu4:oppo5:vivo8:google)
     * @param platformMessageId Manufacturer message ID, can be blank
     */
    public static void reportNotificationClicked(Context context, String messageId, byte platform, String platformMessageId)

        
このコードブロックは、フローティングウィンドウに表示されます

Report to delete the manufacturer channel notification

/** * Report to delete the manufacturer channel notification * * Report via http/https * * @param context Not empty * @param messageId Engagelab message id, not empty * @param platform Manufacturer, value range(1:mi、2:huawei、3:meizu、4:oppo、5:vivo、8:google) * @param platformMessageId Manufacturer message ID, can be blank */ public static void reportNotificationDeleted(Context context, String messageId, byte platform, String platformMessageId)
              /**
     * Report to delete the manufacturer channel notification
     * 
     * Report via http/https
     *
     * @param context           Not empty
     * @param messageId         Engagelab message id, not empty
     * @param platform          Manufacturer, value range(1:mi、2:huawei、3:meizu、4:oppo、5:vivo、8:google)
     * @param platformMessageId Manufacturer message ID, can be blank
     */
    public static void reportNotificationDeleted(Context context, String messageId, byte platform, String platformMessageId)

        
このコードブロックは、フローティングウィンドウに表示されます

Report to open the manufacturer channel notification

/** * Report to open the manufacturer channel notification * * Report via http/https * * @param context Not empty * @param messageId Engagelab message id, not empty * @param platform Manufacturer, value range(1:mi、2:huawei、3:meizu、4:oppo、5:vivo、8:google) * @param platformMessageId Manufacturer message ID, can be blank */ public static void reportNotificationOpened(Context context, String messageId, byte platform, String platformMessageId)
              /**
     * Report to open the manufacturer channel notification
     * 
     * Report via http/https
     *
     * @param context           Not empty
     * @param messageId         Engagelab message id, not empty
     * @param platform          Manufacturer, value range(1:mi、2:huawei、3:meizu、4:oppo、5:vivo、8:google)
     * @param platformMessageId Manufacturer message ID, can be blank
     */
    public static void reportNotificationOpened(Context context, String messageId, byte platform, String platformMessageId)

        
このコードブロックは、フローティングウィンドウに表示されます

Upload manufacturer token

/** * Upload vendor token * * It needs to be called after the Engagelab long connection is established successfully, otherwise it is invalid.MTCommonReceiver.onConnectStatus回调结果为true时为长连接建立成功。 * * Upload via tcp * * @param context Not empty * @param platform Manufacturer, value range(1:mi、2:huawei、3:meizu、4:oppo、5:vivo、8:google) * @param token Manufacturer message ID, can be blank * @param region Overseas versions of Xiaomi and oppo need to set the region, fill in such as "US" according to the region of use, etc., fill in null for non-overseas versions */ public static void uploadPlatformToken(Context context, byte platform, String token, String region)
              /**
     * Upload vendor token
     *
     * It needs to be called after the Engagelab long connection is established successfully, otherwise it is invalid.MTCommonReceiver.onConnectStatus回调结果为true时为长连接建立成功。
     * 
     * Upload via tcp
     *
     * @param context  Not empty
     * @param platform Manufacturer, value range(1:mi、2:huawei、3:meizu、4:oppo、5:vivo、8:google)
     * @param token    Manufacturer message ID, can be blank
     * @param region Overseas versions of Xiaomi and oppo need to set the region, fill in such as "US" according to the region of use, etc., fill in null for non-overseas versions
     */
    public static void uploadPlatformToken(Context context, byte platform, String token, String region)

        
このコードブロックは、フローティングウィンドウに表示されます
在文档中心打开
Contact Sales