Engagelab通道集成文档

最新更新:2022-12-20

获取应用信息

在控制台上创建应用,创建成功后自动生成 AppKey 用以标识该应用,详情参考 应用设置文档

1.libs导包

  • 手动方式
将libs包下面的mt-sdk-x.x.x.aar导入libs目录
              将libs包下面的mt-sdk-x.x.x.aar导入libs目录

        
此代码块在浮窗中显示
  • 自动方式
dependencies { //必须 主包 implementation 'com.engagelab:engagelab:4.3.3' // 此处以4.3.3 版本为例。 //可选,google厂商 implementation 'com.engagelab.plugin:google:4.3.3' // 此处以4.3.3 版本为例。 //可选,honor厂商 implementation 'com.engagelab.plugin:honor:4.3.3' // 此处以4.3.3 版本为例。 implementation 'com.engagelab.plugin:honor_th_push:4.3.3' // 此处以4.3.3 版本为例。 //可选,huawei厂商 implementation 'com.engagelab.plugin:huawei:4.3.3' // 此处以4.3.3 版本为例。 //可选,mi厂商,国内版 implementation 'com.engagelab.plugin:mi:4.3.3' // 此处以4.3.3 版本为例。 //可选,mi厂商,海外版 implementation 'com.engagelab.plugin:mi_global:4.3.3' // 此处以4.3.3 版本为例。 //可选,meizu厂商 implementation 'com.engagelab.plugin:meizu:4.3.3' // 此处以4.3.3 版本为例。 //可选,oppo厂商 implementation 'com.engagelab.plugin:oppo:4.3.3' // 此处以4.3.3 版本为例。 implementation 'com.engagelab.plugin:oppo_th_push:4.3.3' // 此处以4.3.3 版本为例。 //可选,vivo厂商 implementation 'com.engagelab.plugin:vivo:4.3.3' // 此处以4.3.3 版本为例。 }
          dependencies {
  //必须 主包
  implementation 'com.engagelab:engagelab:4.3.3' // 此处以4.3.3 版本为例。
  //可选,google厂商
  implementation 'com.engagelab.plugin:google:4.3.3' // 此处以4.3.3 版本为例。
  //可选,honor厂商
  implementation 'com.engagelab.plugin:honor:4.3.3' // 此处以4.3.3 版本为例。
  implementation 'com.engagelab.plugin:honor_th_push:4.3.3' // 此处以4.3.3 版本为例。
  //可选,huawei厂商
  implementation 'com.engagelab.plugin:huawei:4.3.3' // 此处以4.3.3 版本为例。
  //可选,mi厂商,国内版
  implementation 'com.engagelab.plugin:mi:4.3.3' // 此处以4.3.3 版本为例。
  //可选,mi厂商,海外版
  implementation 'com.engagelab.plugin:mi_global:4.3.3' // 此处以4.3.3 版本为例。
  //可选,meizu厂商
  implementation 'com.engagelab.plugin:meizu:4.3.3' // 此处以4.3.3 版本为例。
  //可选,oppo厂商
  implementation 'com.engagelab.plugin:oppo:4.3.3' // 此处以4.3.3 版本为例。
  implementation 'com.engagelab.plugin:oppo_th_push:4.3.3' // 此处以4.3.3 版本为例。
  //可选,vivo厂商
  implementation 'com.engagelab.plugin:vivo:4.3.3' // 此处以4.3.3 版本为例。
}

        
此代码块在浮窗中显示

2.build.gradle配置

plugins { id 'com.android.application' } android { ... defaultConfig { // app packageName,需要与控制台上的一样 applicationId "com.engagelab.app" ... manifestPlaceholders = [ //appKey,需要与控制台上的一样,与packageName是一对一关系 ENGAGELAB_PRIVATES_APPKEY : "您的appkey", // Engagelab appChannel,用于渠道统计 ENGAGELAB_PRIVATES_CHANNEL: "developer", // Engagelab process,Engagelabsdk工作所在的进程,注意:开头 ENGAGELAB_PRIVATES_PROCESS: ":remote", //数据中心名称,填空""时,默认"Singapore"数据中心 ENGAGELAB_PRIVATES_SITE_NAME: "Singapore" ] } } dependencies { implementation fileTree(include: ['*.jar', '*.aar'], dir: 'libs') }
          plugins {
    id 'com.android.application'
}

android {
    ...

    defaultConfig {
        // app packageName,需要与控制台上的一样
        applicationId "com.engagelab.app"
        ...
                
        manifestPlaceholders = [
                //appKey,需要与控制台上的一样,与packageName是一对一关系
                ENGAGELAB_PRIVATES_APPKEY : "您的appkey",
                // Engagelab appChannel,用于渠道统计
                ENGAGELAB_PRIVATES_CHANNEL: "developer",
                // Engagelab process,Engagelabsdk工作所在的进程,注意:开头
                ENGAGELAB_PRIVATES_PROCESS: ":remote",
                //数据中心名称,填空""时,默认"Singapore"数据中心
                ENGAGELAB_PRIVATES_SITE_NAME: "Singapore"
        ]
    }
}

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

        
此代码块在浮窗中显示

3.创建必须组件

package com.engagelab.app.component; import com.engagelab.privates.common.component.MTCommonService; /** * 开发者继承MTCommonService,可以使长连接更长时间存活 * <p> * 空实现即可 */ public class UserService extends MTCommonService { }
          package com.engagelab.app.component;

import com.engagelab.privates.common.component.MTCommonService;

/**
 * 开发者继承MTCommonService,可以使长连接更长时间存活
 * <p>
 * 空实现即可
 */
public class UserService extends MTCommonService {


}

        
此代码块在浮窗中显示
package com.engagelab.app.component; import android.content.Context; import android.widget.Toast; import java.util.Arrays; import com.engagelab.app.common.ExampleGlobal; import com.engagelab.app.listener.StatusObserver; import com.engagelab.app.log.ExampleLogger; import com.engagelab.privates.common.component.MTCommonReceiver; import com.engagelab.privates.core.api.MTCorePrivatesApi; import com.engagelab.privates.core.api.WakeMessage; import com.engagelab.privates.push.api.CustomMessage; import com.engagelab.privates.push.api.MobileNumberMessage; import com.engagelab.privates.push.api.NotificationMessage; import com.engagelab.privates.push.api.PlatformTokenMessage; /** * 开发者继承MTCommonReceiver,可以获得sdk的方法回调 * <p> * 所有回调均在主线程 */ public class UserReceiver extends MTCommonReceiver { private static final String TAG = "UserReceiver"; /** * 应用通知开关状态回调 * * @param context 不为空 * @param enable 通知开关是否开,true为打开,false为关闭 */ @Override public void onNotificationStatus(Context context, boolean enable) { ExampleLogger.i(TAG, "onNotificationStatus:" + enable); Toast.makeText(context.getApplicationContext(), "onNotificationStatus " + enable, Toast.LENGTH_SHORT).show(); ExampleGlobal.isNotificationEnable = enable; if (StatusObserver.getInstance().getListener() != null) { StatusObserver.getInstance().getListener().onNotificationStatus(enable); } } /** * 长连接状态回调 * * @param context 不为空 * @param enable 是否连接 */ @Override public void onConnectStatus(Context context, boolean enable) { ExampleLogger.i(TAG, "onConnectState:" + enable); Toast.makeText(context.getApplicationContext(), "onConnectStatus " + enable, Toast.LENGTH_SHORT).show(); ExampleGlobal.isConnectEnable = enable; if (StatusObserver.getInstance().getListener() != null) { StatusObserver.getInstance().getListener().onConnectStatus(enable); } // 长连接成功可获取registrationId if (enable) { String registrationId = MTCorePrivatesApi.getRegistrationId(context); ExampleLogger.i(TAG, "registrationId:" + registrationId); } } /** * 通知消息到达回调 * * @param context 不为空 * @param notificationMessage 通知消息 */ @Override public void onNotificationArrived(Context context, NotificationMessage notificationMessage) { ExampleLogger.i(TAG, "onNotificationArrived:" + notificationMessage.toString()); } /** * 通知消息在前台不显示 * * @param context 不为空 * @param notificationMessage 通知消息 */ @Override public void onNotificationUnShow(Context context, NotificationMessage notificationMessage) { ExampleLogger.i(TAG, "onNotificationUnShow:" + notificationMessage.toString()); } /** * 通知消息点击回调 * * @param context 不为空 * @param notificationMessage 通知消息 */ @Override public void onNotificationClicked(Context context, NotificationMessage notificationMessage) { ExampleLogger.i(TAG, "onNotificationClicked:" + notificationMessage.toString()); } /** * 通知消息删除回调 * * @param context 不为空 * @param notificationMessage 通知消息 */ @Override public void onNotificationDeleted(Context context, NotificationMessage notificationMessage) { ExampleLogger.i(TAG, "onNotificationDeleted:" + notificationMessage.toString()); } /** * 自定义消息回调 * * @param context 不为空 * @param customMessage 自定义消息 */ @Override public void onCustomMessage(Context context, CustomMessage customMessage) { ExampleLogger.i(TAG, "onCustomMessage:" + customMessage.toString()); } /** * 厂商token消息回调 * * @param context 不为空 * @param platformTokenMessage 厂商token消息 */ @Override public void onPlatformToken(Context context, PlatformTokenMessage platformTokenMessage) { ExampleLogger.i(TAG, "onPlatformToken:" + platformTokenMessage.toString()); } }
          package com.engagelab.app.component;

import android.content.Context;
import android.widget.Toast;

import java.util.Arrays;

import com.engagelab.app.common.ExampleGlobal;
import com.engagelab.app.listener.StatusObserver;
import com.engagelab.app.log.ExampleLogger;
import com.engagelab.privates.common.component.MTCommonReceiver;
import com.engagelab.privates.core.api.MTCorePrivatesApi;
import com.engagelab.privates.core.api.WakeMessage;
import com.engagelab.privates.push.api.CustomMessage;
import com.engagelab.privates.push.api.MobileNumberMessage;
import com.engagelab.privates.push.api.NotificationMessage;
import com.engagelab.privates.push.api.PlatformTokenMessage;

/**
 * 开发者继承MTCommonReceiver,可以获得sdk的方法回调
 * <p>
 * 所有回调均在主线程
 */
public class UserReceiver extends MTCommonReceiver {

    private static final String TAG = "UserReceiver";

    /**
     * 应用通知开关状态回调
     *
     * @param context 不为空
     * @param enable  通知开关是否开,true为打开,false为关闭
     */
    @Override
    public void onNotificationStatus(Context context, boolean enable) {
        ExampleLogger.i(TAG, "onNotificationStatus:" + enable);
        Toast.makeText(context.getApplicationContext(), "onNotificationStatus " + enable, Toast.LENGTH_SHORT).show();
        ExampleGlobal.isNotificationEnable = enable;
        if (StatusObserver.getInstance().getListener() != null) {
            StatusObserver.getInstance().getListener().onNotificationStatus(enable);
        }
    }

    /**
     * 长连接状态回调
     *
     * @param context 不为空
     * @param enable  是否连接
     */
    @Override
    public void onConnectStatus(Context context, boolean enable) {
        ExampleLogger.i(TAG, "onConnectState:" + enable);
        Toast.makeText(context.getApplicationContext(), "onConnectStatus " + enable, Toast.LENGTH_SHORT).show();
        ExampleGlobal.isConnectEnable = enable;
        if (StatusObserver.getInstance().getListener() != null) {
            StatusObserver.getInstance().getListener().onConnectStatus(enable);
        }
        // 长连接成功可获取registrationId
        if (enable) {
            String registrationId = MTCorePrivatesApi.getRegistrationId(context);
            ExampleLogger.i(TAG, "registrationId:" + registrationId);
        }
    }

    /**
     * 通知消息到达回调
     *
     * @param context             不为空
     * @param notificationMessage 通知消息
     */
    @Override
    public void onNotificationArrived(Context context, NotificationMessage notificationMessage) {
        ExampleLogger.i(TAG, "onNotificationArrived:" + notificationMessage.toString());
    }

    /**
     * 通知消息在前台不显示
     *
     * @param context             不为空
     * @param notificationMessage 通知消息
     */
    @Override
    public void onNotificationUnShow(Context context, NotificationMessage notificationMessage) {
        ExampleLogger.i(TAG, "onNotificationUnShow:" + notificationMessage.toString());
    }

    /**
     * 通知消息点击回调
     *
     * @param context             不为空
     * @param notificationMessage 通知消息
     */
    @Override
    public void onNotificationClicked(Context context, NotificationMessage notificationMessage) {
        ExampleLogger.i(TAG, "onNotificationClicked:" + notificationMessage.toString());
    }

    /**
     * 通知消息删除回调
     *
     * @param context             不为空
     * @param notificationMessage 通知消息
     */
    @Override
    public void onNotificationDeleted(Context context, NotificationMessage notificationMessage) {
        ExampleLogger.i(TAG, "onNotificationDeleted:" + notificationMessage.toString());
    }

    /**
     * 自定义消息回调
     *
     * @param context       不为空
     * @param customMessage 自定义消息
     */
    @Override
    public void onCustomMessage(Context context, CustomMessage customMessage) {
        ExampleLogger.i(TAG, "onCustomMessage:" + customMessage.toString());
    }

    /**
     * 厂商token消息回调
     *
     * @param context              不为空
     * @param platformTokenMessage 厂商token消息
     */
    @Override
    public void onPlatformToken(Context context, PlatformTokenMessage platformTokenMessage) {
        ExampleLogger.i(TAG, "onPlatformToken:" + platformTokenMessage.toString());
    }

}

        
此代码块在浮窗中显示

4.AndroidManifest.xml配置

<?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" package="com.engagelab.app"> <!-- 必须,网络权限 --> <uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> <!-- 可选,通知震动 --> <uses-permission android:name="android.permission.VIBRATE" /> <application android:name="com.engagelab.app.MainApplication" android:allowBackup="false" android:icon="@drawable/ic_launcher" android:label="@string/app_name" android:supportsRtl="true" android:theme="@style/Theme.MT" android:usesCleartextTraffic="true" tools:targetApi="m"> <!-- 如果使用http请求,则需要允许使用http --> ..................................................................................................... <!-- 由于此类具有长连接功能,手机厂商省电优化时可能直接杀死包名带Engagelab字样的service --> <!-- 所以需要开发者继承com.engagelab.app.component.MTCommonService,提升长连接存活率,已达到提高消息到达率的目的 --> <service android:name="com.engagelab.app.component.UserService" android:exported="false" android:process="${ENGAGELAB_PRIVATES_PROCESS}"> <intent-filter> <action android:name="com.engagelab.privates.intent.USER_SERVICE" /> </intent-filter> </service> <!-- 用于接收Engagelab业务的回调,包含了长连接状态/通知开关状态/通知消息到达/通知消息点击/通知消息删除/自定义消息/厂商token回调 --> <!-- 不需要配置子进程,此回调中在主进程中,方便业务操作 --> <receiver android:name="com.engagelab.app.component.UserReceiver" android:exported="false"> <intent-filter> <action android:name="com.engagelab.privates.intent.USER_RECEIVER" /> </intent-filter> </receiver> </application> </manifest>
          <?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    package="com.engagelab.app">
        
    <!-- 必须,网络权限 -->
    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <!-- 可选,通知震动 -->
    <uses-permission android:name="android.permission.VIBRATE" /> 
        
    <application
        android:name="com.engagelab.app.MainApplication"
        android:allowBackup="false"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:supportsRtl="true"
        android:theme="@style/Theme.MT"
        android:usesCleartextTraffic="true"
        tools:targetApi="m"> <!-- 如果使用http请求,则需要允许使用http -->

                .....................................................................................................
                
        <!-- 由于此类具有长连接功能,手机厂商省电优化时可能直接杀死包名带Engagelab字样的service -->
        <!-- 所以需要开发者继承com.engagelab.app.component.MTCommonService,提升长连接存活率,已达到提高消息到达率的目的 -->
        <service
            android:name="com.engagelab.app.component.UserService"
            android:exported="false"
            android:process="${ENGAGELAB_PRIVATES_PROCESS}">
            <intent-filter>
                <action android:name="com.engagelab.privates.intent.USER_SERVICE" />
            </intent-filter>
        </service>

        <!-- 用于接收Engagelab业务的回调,包含了长连接状态/通知开关状态/通知消息到达/通知消息点击/通知消息删除/自定义消息/厂商token回调 -->
        <!-- 不需要配置子进程,此回调中在主进程中,方便业务操作 -->
        <receiver
            android:name="com.engagelab.app.component.UserReceiver"
            android:exported="false">
            <intent-filter>
                <action android:name="com.engagelab.privates.intent.USER_RECEIVER" />
            </intent-filter>
        </receiver>

    </application>

</manifest>

        
此代码块在浮窗中显示

5.环境配置

package com.engagelab.app; import android.app.Application; import com.engagelab.privates.core.api.Address; import com.engagelab.privates.core.api.MTCorePrivatesApi; import com.engagelab.privates.push.api.MTPushPrivatesApi; /** * 用于演示ENGAGELAB-sdk配置 */ public class MainApplication extends Application { private static final String TAG = "MainApplication"; @Override public void onCreate() { super.onCreate(); // 必须在application.onCreate中配置,不要判断进程,sdk内部有判断 MTCorePrivatesApi.configDebugMode(this, true); // 后台没升级tag: V3.5.4-newportal-20210823-gamma.57版本,前端必须调用此方法,否则通知点击跳转有问题 // MTPushPrivatesApi.configOldPushVersion(context.getApplicationContext()); // 初始化推送 // MTPushPrivatesApi.init(this); } }
          package com.engagelab.app;

import android.app.Application;

import com.engagelab.privates.core.api.Address;
import com.engagelab.privates.core.api.MTCorePrivatesApi;
import com.engagelab.privates.push.api.MTPushPrivatesApi;

/**
 * 用于演示ENGAGELAB-sdk配置
 */
public class MainApplication extends Application {

    private static final String TAG = "MainApplication";

    @Override
    public void onCreate() {
        super.onCreate();


        // 必须在application.onCreate中配置,不要判断进程,sdk内部有判断
        MTCorePrivatesApi.configDebugMode(this, true);

        // 后台没升级tag: V3.5.4-newportal-20210823-gamma.57版本,前端必须调用此方法,否则通知点击跳转有问题
        // MTPushPrivatesApi.configOldPushVersion(context.getApplicationContext());

        // 初始化推送
        // MTPushPrivatesApi.init(this);
    }

}

        
此代码块在浮窗中显示

6.创建通知点击跳转组件

package com.engagelab.app.component; import android.app.Activity; import android.content.Context; import android.content.Intent; import android.os.Bundle; import android.widget.TextView; import android.widget.Toast; import com.engagelab.app.R; import com.engagelab.app.log.ExampleLogger; import com.engagelab.privates.push.api.MTPushPrivatesApi; import com.engagelab.privates.push.api.NotificationMessage; import com.engagelab.privates.push.constants.MTPushConstants; /** * 用于演示-点击通知后activity跳转 * * 确保没有调用{@link MTPushPrivatesApi#configOldPushVersion(Context)},否则通知点击跳转不会跳转到此页面 * <p> * 不需要调用{@link MTPushPrivatesApi#reportNotificationOpened(Context, String, byte, String)},sdk内部已做处理 */ public class UserActivity400 extends Activity { private static final String TAG = "UserActivity400"; private TextView tvMessage; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_intent); tvMessage = findViewById(R.id.tv_message); onIntent(getIntent()); } @Override protected void onNewIntent(Intent intent) { super.onNewIntent(intent); onIntent(intent); } private void onIntent(Intent intent) { try { Toast.makeText(this, TAG, Toast.LENGTH_SHORT).show(); if (intent == null) { return; } //3.4.0版本开始不再使用对象,而使用json数据 String notificationMessage = intent.getStringExtra("message_json"); if (notificationMessage == null) { return; } ExampleLogger.d(TAG, "notificationMessage:" + notificationMessage.toString()); tvMessage.setText(notificationMessage.toString()); } catch (Throwable throwable) { throwable.printStackTrace(); } } }
          package com.engagelab.app.component;

import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.widget.TextView;
import android.widget.Toast;

import com.engagelab.app.R;
import com.engagelab.app.log.ExampleLogger;
import com.engagelab.privates.push.api.MTPushPrivatesApi;
import com.engagelab.privates.push.api.NotificationMessage;
import com.engagelab.privates.push.constants.MTPushConstants;

/**
 * 用于演示-点击通知后activity跳转
 *
 * 确保没有调用{@link MTPushPrivatesApi#configOldPushVersion(Context)},否则通知点击跳转不会跳转到此页面
 * <p>
 * 不需要调用{@link MTPushPrivatesApi#reportNotificationOpened(Context, String, byte, String)},sdk内部已做处理
 */
public class UserActivity400 extends Activity {

    private static final String TAG = "UserActivity400";

    private TextView tvMessage;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_intent);
        tvMessage = findViewById(R.id.tv_message);
        onIntent(getIntent());
    }

    @Override
    protected void onNewIntent(Intent intent) {
        super.onNewIntent(intent);
        onIntent(intent);
    }

    private void onIntent(Intent intent) {
        try {
            Toast.makeText(this, TAG, Toast.LENGTH_SHORT).show();
            if (intent == null) {
                return;
            }
            //3.4.0版本开始不再使用对象,而使用json数据
            String notificationMessage = intent.getStringExtra("message_json");
            if (notificationMessage == null) {
                return;
            }
            ExampleLogger.d(TAG, "notificationMessage:" + notificationMessage.toString());
            tvMessage.setText(notificationMessage.toString());
        } catch (Throwable throwable) {
            throwable.printStackTrace();
        }
    }
        
}

        
此代码块在浮窗中显示

7.AndroidManifest.xml点击跳转组件配置

<?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" package="com.engagelab.app"> <!-- 必须,网络权限 --> <uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> <!-- 可选,通知震动 --> <uses-permission android:name="android.permission.VIBRATE" /> <application android:name="com.engagelab.app.MainApplication" android:allowBackup="false" android:icon="@drawable/ic_launcher" android:label="@string/app_name" android:supportsRtl="true" android:theme="@style/Theme.MT" android:usesCleartextTraffic="true" tools:targetApi="m"> <!-- 如果使用http请求,则需要允许使用http --> .............................................................. <!-- 用于演示通知点击跳转 --> <activity android:name="com.engagelab.app.component.UserActivity400" android:exported="false" android:launchMode="singleTask" /> <!-- 用于演示deepLink的通知点击跳转 --> <!-- <activity--> <!-- android:name="com.engagelab.app.component.UserActivity400"--> <!-- android:exported="false" >--> <!-- <intent-filter>--> <!-- <data android:scheme="你的scheme"/>--> <!-- <data android:host="你的host"/>--> <!-- <action android:name="android.intent.action.VIEW" />--> <!-- <category android:name="android.intent.category.DEFAULT" />--> <!-- <category android:name="android.intent.category.BROWSABLE" />--> <!-- </intent-filter>--> <!-- </activity>--> <!--白名单本地中转验证:MTPush4.2.3版本开始,配置ENGAGELAB_PRIVATES_TRANSFER后,sdk会做本地验证;不配置就不做本地验证。如果开启本地验证,请将要跳转的目标Activity配置在这里;如果有多个目标Activity,请用/分割开。--> <meta-data android:name="ENGAGELAB_PRIVATES_TRANSFER" android:value="com.engagelab.app.component.UserActivity400" /> <!-- google push need,不需要 google 通道,则删除 --> <meta-data android:name="com.google.firebase.messaging.default_notification_icon" android:resource="@drawable/mtpush_notification_icon" /> <!-- huawei push need,不需要 huawei 通道,则删除 --> <meta-data android:name="com.huawei.messaging.default_notification_icon" android:resource="@drawable/mtpush_notification_icon" /> </application> </manifest>
          <?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    package="com.engagelab.app">

    <!-- 必须,网络权限 -->
    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <!-- 可选,通知震动 -->
    <uses-permission android:name="android.permission.VIBRATE" />

    <application
        android:name="com.engagelab.app.MainApplication"
        android:allowBackup="false"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:supportsRtl="true"
        android:theme="@style/Theme.MT"
        android:usesCleartextTraffic="true"
        tools:targetApi="m"> <!-- 如果使用http请求,则需要允许使用http -->

        ..............................................................

        <!-- 用于演示通知点击跳转 -->
        <activity
            android:name="com.engagelab.app.component.UserActivity400"
            android:exported="false"
            android:launchMode="singleTask" />

        <!-- 用于演示deepLink的通知点击跳转 -->
<!--        <activity-->
<!--            android:name="com.engagelab.app.component.UserActivity400"-->
<!--            android:exported="false" >-->
<!--            <intent-filter>-->
<!--                <data android:scheme="你的scheme"/>-->
<!--                <data android:host="你的host"/>-->
<!--                <action android:name="android.intent.action.VIEW" />-->
<!--                <category android:name="android.intent.category.DEFAULT" />-->
<!--                <category android:name="android.intent.category.BROWSABLE" />-->
<!--            </intent-filter>-->
<!--        </activity>-->

            
        <!--白名单本地中转验证:MTPush4.2.3版本开始,配置ENGAGELAB_PRIVATES_TRANSFER后,sdk会做本地验证;不配置就不做本地验证。如果开启本地验证,请将要跳转的目标Activity配置在这里;如果有多个目标Activity,请用/分割开。-->
        <meta-data
            android:name="ENGAGELAB_PRIVATES_TRANSFER"
            android:value="com.engagelab.app.component.UserActivity400" />
                
        <!-- google push need,不需要 google 通道,则删除 -->
        <meta-data
            android:name="com.google.firebase.messaging.default_notification_icon"
            android:resource="@drawable/mtpush_notification_icon" />

        <!-- huawei push need,不需要 huawei 通道,则删除 -->
        <meta-data
            android:name="com.huawei.messaging.default_notification_icon"
            android:resource="@drawable/mtpush_notification_icon" />

    </application>

</manifest>

        
此代码块在浮窗中显示
在文档中心打开