dependencies {//移动推送主包implementation "com.tencent.tpns:tpns:1.3.6.2-release"// 小米推送依赖包implementation "com.tencent.tpns:xiaomi:1.3.6.2-release"// 魅族推送依赖包implementation "com.tencent.tpns:meizu:1.3.6.2-release"// 华为推送依赖包implementation "com.tencent.tpns:huawei:1.3.6.2-release"// 华为推送 HMS Core Push 模块依赖包implementation 'com.huawei.hms:push:6.7.0.300'// OPPO 推送依赖包implementation "com.tencent.tpns:oppo:1.3.6.2-release"// 自 SDK 1.3.2.0 起,需一并加入以下依赖语句,否则可能导致 OPPO 推送注册失败implementation 'com.google.code.gson:gson:2.6.2'implementation 'commons-codec:commons-codec:1.15'// vivo 推送依赖包implementation "com.tencent.tpns:vivo:1.3.6.2-release"// 荣耀推送依赖包implementation "com.tencent.tpns:honor:1.3.6.2-release"}
tpns-*.jar 文件替换工程内原本的各 tpns-*.jar 文件。implementation 'com.google.code.gson:gson:2.6.2'implementation 'commons-codec:commons-codec:1.15'
<activityandroid:name="com.xiaomi.mipush.sdk.NotificationClickedActivity"android:theme="@android:style/Theme.Translucent.NoTitleBar"android:launchMode="singleInstance"android:exported="true"android:enabled="true"></activity>
package com.meizu.cloud.pushinternal;public class R {public static final class drawable {// 资源文件 stat_sys_third_app_notify.png 请从移动推送 SDK 压缩包魅族厂商依赖目录的 flyme-notification-res 文件夹获取,并复制到应用自己的资源目录下public static final int stat_sys_third_app_notify = com.tencent.android.tpns.demo.R.drawable.stat_sys_third_app_notify;}}
<uses-permission android:name="com.meizu.flyme.permission.PUSH" />
com.meizu.cloud.pushsdk.SystemReceiver,新增以下 receiver 节点:<receiverandroid:name="com.meizu.cloud.pushsdk.MzPushSystemReceiver"android:exported="false"android:permission="com.meizu.flyme.permission.PUSH"><intent-filter><action android:name="com.meizu.flyme.push.intent.PUSH_SYSTEM" /></intent-filter></receiver>
com.heytap.mcssdk.R 变更包名为 com.pushsdk.R(如未添加过则直接新增),否则可能导致 OPPO 推送注册失败,示例如下:package com.pushsdk;class R {public static final class string {public final static int system_default_channel = com.tencent.android.tpns.demo.R.string.app_name; // 可更改为自定义字符串资源ID}}
implementation files('libs/gson-2.6.2-sources.jar')implementation files('libs/commons-codec-1.15.jar')
com.vivo.push.sdk.service.CommandClientService 为如下内容:<serviceandroid:name="com.vivo.push.sdk.service.CommandClientService"android:permission="com.push.permission.UPSTAGESERVICE"android:exported="true" />
<meta-dataandroid:name="sdk_version_vivo"android:value="483" /><meta-dataandroid:name="local_iv"android:value="MzMsMzQsMzUsMzYsMzcsMzgsMzksNDAsNDEsMzIsMzgsMzcsMzYsMzUsMzQsMzMsI0AzNCwzMiwzMywzNywzMywzNCwzMiwzMywzMywzMywzNCw0MSwzNSwzNSwzMiwzMiwjQDMzLDM0LDM1LDM2LDM3LDM4LDM5LDQwLDQxLDMyLDM4LDM3LDMzLDM1LDM0LDMzLCNAMzQsMzIsMzMsMzcsMzMsMzQsMzIsMzMsMzMsMzMsMzQsNDEsMzUsMzIsMzIsMzI" />
<activityandroid:name="com.tencent.android.tpush.InnerTpnsActivity"android:exported="false"android:launchMode="singleInstance"android:theme="@android:style/Theme.Translucent.NoTitleBar"><intent-filter><action android:name="${applicationId}.OPEN_TPNS_ACTIVITY_V2" /><category android:name="android.intent.category.DEFAULT" /></intent-filter><intent-filter><dataandroid:host="${applicationId}"android:scheme="stpns" /><action android:name="android.intent.action.VIEW" /><category android:name="android.intent.category.BROWSABLE" /><category android:name="android.intent.category.DEFAULT" /></intent-filter><intent-filter><action android:name="android.intent.action" /></intent-filter></activity>
<!-- 手动集成时该receiver的intent-filter只保留下面3个action --><receiverandroid:name="com.tencent.android.tpush.XGPushReceiver"android:exported="false"android:process=":xg_vip_service" ><intent-filter android:priority="0x7fffffff" tools:node="replace" ><!-- 【必须】 信鸽SDK的内部广播 --><action android:name="com.tencent.android.xg.vip.action.SDK" /><action android:name="com.tencent.android.xg.vip.action.INTERNAL_PUSH_MESSAGE" /><action android:name="com.tencent.android.xg.vip.action.ACTION_SDK_KEEPALIVE" /></intent-filter></receiver><!-- 如果您有集成小米通道,手动集成小米通道时,将该receiver对应的intent-filter删除 --><receiverandroid:name="com.xiaomi.push.service.receivers.NetworkStatusReceiver"android:exported="true" ><intent-filter tools:node="remove"><action android:name="android.net.conn.CONNECTIVITY_CHANGE" /><category android:name="android.intent.category.DEFAULT" /></intent-filter></receiver>
allprojects {repositories {google()// 谷歌推荐 MavenCentral 镜像源mavenCentral()jcenter()// 腾讯云镜像源maven { url 'https://mirrors.tencent.com/nexus/repository/maven-public/' }}}
XGPushBaseReceiver 的实现类中增加实现方法 onQueryTagsResult。代码示例如下:public class MessageReceiver extends XGPushBaseReceiver {// 其他回调接口// ...// 标签查询回调接口public void onQueryTagsResult(Context context, int errorCode, String data, String operateName) {Log.i(LogTag, "action - onQueryTagsResult, errorCode:" + errorCode + ", operateName:" + operateName + ", data: " + data);}}
<activityandroid:name="com.tencent.android.tpush.XGPushActivity"><intent-filter><action android:name="android.intent.action" /></intent-filter></activity><service android:exported="false"android:process=":xg_vip_service"android:name="com.tencent.bigdata.mqttchannel.services.MqttService" /><providerandroid:exported="false"android:name="com.tencent.bigdata.baseapi.base.SettingsContentProvider"android:authorities="应用包名.XG_SETTINGS_PROVIDER" />
<activity android:name="com.tencent.android.tpush.TpnsActivity"android:theme="@android:style/Theme.Translucent.NoTitleBar"><intent-filter><action android:name="${applicationId}.OPEN_TPNS_ACTIVITY" /><category android:name="android.intent.category.DEFAULT" /></intent-filter><intent-filter><dataandroid:scheme="tpns"android:host="应用包名"/><action android:name="android.intent.action.VIEW" /><category android:name="android.intent.category.BROWSABLE" /><category android:name="android.intent.category.DEFAULT" /></intent-filter></activity><service android:exported="false"android:process=":xg_vip_service"android:name="com.tencent.tpns.mqttchannel.services.MqttService" /><providerandroid:exported="false"android:name="com.tencent.tpns.baseapi.base.SettingsContentProvider"android:authorities="应用包名.XG_SETTINGS_PROVIDER" />
-keep public class * extends android.app.Service-keep public class * extends android.content.BroadcastReceiver-keep class com.tencent.android.tpush.** {*;}-keep class com.tencent.tpns.baseapi.** {*;}-keep class com.tencent.tpns.mqttchannel.** {*;}-keep class com.tencent.tpns.dataacquisition.** {*;}
com.heytap.mcssdk.R,代码如下:package com.heytap.mcssdk;class R {public static final class string {public static final int system_default_channel =com.tencent.android.tpns.demo.R.string.oppo_system_default_channel;//可更改为自定义字符串资源ID}}
<serviceandroid:name="com.heytap.mcssdk.PushService"android:permission="com.coloros.mcs.permission.SEND_MCS_MESSAGE"><intent-filter><action android:name="com.coloros.mcs.action.RECEIVE_MCS_MESSAGE"/></intent-filter></service><serviceandroid:name="com.heytap.mcssdk.AppPushService"android:permission="com.heytap.mcs.permission.SEND_MCS_MESSAGE"><intent-filter><action android:name="com.heytap.mcs.action.RECEIVE_MCS_MESSAGE"/></intent-filter></service>
<serviceandroid:name="com.heytap.msp.push.service.CompatibleDataMessageCallbackService"android:permission="com.coloros.mcs.permission.SEND_MCS_MESSAGE"><intent-filter><action android:name="com.coloros.mcs.action.RECEIVE_MCS_MESSAGE"/></intent-filter></service><serviceandroid:name="com.heytap.msp.push.service.DataMessageCallbackService"android:permission="com.heytap.mcs.permission.SEND_PUSH_MESSAGE"><intent-filter><action android:name="com.heytap.mcs.action.RECEIVE_MCS_MESSAGE"/><action android:name="com.heytap.msp.push.RECEIVE_MCS_MESSAGE"/></intent-filter></service>
-keep public class * extends android.app.Service-keep class com.heytap.mcssdk.** {*;}-keep class com.heytap.msp.push.** { *;}
文档反馈