Engagelab 通道集成指南
最新更新:2022-11-29
Engagelab 通道集成指南
獲取應用程式資訊
在控制台上創建應用程式,創建成功後自動生成 AppKey 用以標識該應用程式,詳情參考 應用程式設置文檔。
libs 導包
- 手动方式
将libs包下面的mt-sdk-x.x.x.aar导入libs目录
将libs包下面的mt-sdk-x.x.x.aar导入libs目录
此代碼塊在浮窗中顯示
- 自动方式
dependencies {
//必须 主包
implementation 'com.engagelab:engagelab:3.3.0' // 此处以3.3.0 版本为例。
//可选,google厂商
implementation 'com.engagelab.plugin:google:3.3.0' // 此处以3.3.0 版本为例。
//可选,honor厂商
implementation 'com.engagelab.plugin:honor:3.3.0' // 此处以3.3.0 版本为例。
implementation 'com.engagelab.plugin:honor_th_push:3.3.0' // 此处以3.3.0 版本为例。
//可选,huawei厂商
implementation 'com.engagelab.plugin:huawei:3.3.0' // 此处以3.3.0 版本为例。
//可选,mi厂商,国内版
implementation 'com.engagelab.plugin:mi:3.3.0' // 此处以3.3.0 版本为例。
//可选,mi厂商,海外版
implementation 'com.engagelab.plugin:mi_global:3.3.0' // 此处以3.3.0 版本为例。
//可选,meizu厂商
implementation 'com.engagelab.plugin:meizu:3.3.0' // 此处以3.3.0 版本为例。
//可选,oppo厂商
implementation 'com.engagelab.plugin:oppo:3.3.0' // 此处以3.3.0 版本为例。
implementation 'com.engagelab.plugin:oppo_th_push:3.3.0' // 此处以3.3.0 版本为例。
//可选,vivo厂商
implementation 'com.engagelab.plugin:vivo:3.3.0' // 此处以3.3.0 版本为例。
}
dependencies {
//必须 主包
implementation 'com.engagelab:engagelab:3.3.0' // 此处以3.3.0 版本为例。
//可选,google厂商
implementation 'com.engagelab.plugin:google:3.3.0' // 此处以3.3.0 版本为例。
//可选,honor厂商
implementation 'com.engagelab.plugin:honor:3.3.0' // 此处以3.3.0 版本为例。
implementation 'com.engagelab.plugin:honor_th_push:3.3.0' // 此处以3.3.0 版本为例。
//可选,huawei厂商
implementation 'com.engagelab.plugin:huawei:3.3.0' // 此处以3.3.0 版本为例。
//可选,mi厂商,国内版
implementation 'com.engagelab.plugin:mi:3.3.0' // 此处以3.3.0 版本为例。
//可选,mi厂商,海外版
implementation 'com.engagelab.plugin:mi_global:3.3.0' // 此处以3.3.0 版本为例。
//可选,meizu厂商
implementation 'com.engagelab.plugin:meizu:3.3.0' // 此处以3.3.0 版本为例。
//可选,oppo厂商
implementation 'com.engagelab.plugin:oppo:3.3.0' // 此处以3.3.0 版本为例。
implementation 'com.engagelab.plugin:oppo_th_push:3.3.0' // 此处以3.3.0 版本为例。
//可选,vivo厂商
implementation 'com.engagelab.plugin:vivo:3.3.0' // 此处以3.3.0 版本为例。
}
此代碼塊在浮窗中顯示
配置 build.gradle
plugins {id 'com.android.application'}
android {
...
defaultConfig {
// app packageName,需要與 Engagelab 控制台上的一樣
applicationId "com.engagelab.app"
...
manifestPlaceholders = [
// Engagelab appKey,需要與 Engagelab 控制台上的一樣,與 packageName 是一對一關係
ENGAGELAB_PRIVATES_APPKEY : "1c4b749a17f6aca33960a560",
// Engagelab appChannel,用於渠道統計
ENGAGELAB_PRIVATES_CHANNEL: "developer",
// Engagelab process,Engagelabsdk 工作所在的進程,注意: 開頭
ENGAGELAB_PRIVATES_PROCESS: ":remote"
]
}
}
dependencies {implementation fileTree(include: ['*.jar', '*.aar'], dir: 'libs')
}
plugins {id 'com.android.application'}
android {
...
defaultConfig {
// app packageName,需要與 Engagelab 控制台上的一樣
applicationId "com.engagelab.app"
...
manifestPlaceholders = [
// Engagelab appKey,需要與 Engagelab 控制台上的一樣,與 packageName 是一對一關係
ENGAGELAB_PRIVATES_APPKEY : "1c4b749a17f6aca33960a560",
// Engagelab appChannel,用於渠道統計
ENGAGELAB_PRIVATES_CHANNEL: "developer",
// Engagelab process,Engagelabsdk 工作所在的進程,注意: 開頭
ENGAGELAB_PRIVATES_PROCESS: ":remote"
]
}
}
dependencies {implementation fileTree(include: ['*.jar', '*.aar'], dir: 'libs')
}
此代碼塊在浮窗中顯示
創建必須組件
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 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 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());
}
}
此代碼塊在浮窗中顯示
配置 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>
此代碼塊在浮窗中顯示
配置環境
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);
// 初始化推播
// 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);
// 初始化推播
// MTPushPrivatesApi.init(this);
}
}
此代碼塊在浮窗中顯示
创建通知点击跳转组件
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();
}
}
}
此代碼塊在浮窗中顯示
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>
此代碼塊在浮窗中顯示