dependencies {// Tencent Push Notification Service main packageimplementation "com.tencent.tpns:tpns:1.3.6.2-release"// Mi push dependency packageimplementation "com.tencent.tpns:xiaomi:1.3.6.2-release"// Meizu push dependency packageimplementation "com.tencent.tpns:meizu:1.3.6.2-release"// Huawei push dependency packageimplementation "com.tencent.tpns:huawei:1.3.6.2-release"// Dependency package for the HMS Core Push module of Huawei pushimplementation 'com.huawei.hms:push:6.7.0.300'// OPPO push dependency packageimplementation "com.tencent.tpns:oppo:1.3.6.2-release"// For SDK v1.3.2.0 or later, you need to add the following dependency statements. Otherwise, the registration of OPPO PUSH will fail.implementation 'com.google.code.gson:gson:2.6.2'implementation 'commons-codec:commons-codec:1.15'// vivo push dependency packageimplementation "com.tencent.tpns:vivo:1.3.6.2-release"// HONOR push dependency packageimplementation "com.tencent.tpns:honor:1.3.6.2-release"}
tpns-*.jar files in the project with the tpns-*.jar files in the libs directory of the SDK package.implementation 'com.google.code.gson:gson:2.6.2'implementation 'commons-codec:commons-codec:1.15'
application tag in the AndroidManifest file; otherwise, notification clicks may not work on Mi devices on Android 12 or later.<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 {// Copy the resource file `stat_sys_third_app_notify.png` from the `flyme-notification-res` folder of the Meizu dependency directory in the Tencent Push Notification Service SDK package and paste it in your application's resource directorypublic static final int stat_sys_third_app_notify = com.tencent.android.tpns.demo.R.drawable.stat_sys_third_app_notify;}}
AndroidManifest file:<uses-permission android:name="com.meizu.flyme.permission.PUSH" />
com.meizu.cloud.pushsdk.SystemReceiver and add the following receiver node under the application tag:<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 added for OPPO Push to com.pushsdk.R in your project (if it has never been added, add it directly); otherwise, OPPO Push registration may fail. Below is an example: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; // This can be changed to a custom string resource ID}}
commons-codec-1.15.jar and gson-2.6.2-sources.jar files from the OPPO dependency directory in the Tencent Notification Push Service SDK package to the libs directory of your project's app module and import the project. Otherwise, OPPO Push registration may fail.implementation files('libs/gson-2.6.2-sources.jar')implementation files('libs/commons-codec-1.15.jar')
com.vivo.push.sdk.service.CommandClientService under the application tag in the AndroidManifest file as follows:<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" />
application tag in the AndroidManifest file of the application; otherwise, pushes received by the application when it is online may not respond to the notification click event.<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>
application tag in the AndroidManifest file of the application; otherwise, there may be a compliance risk with auto start.<!-- During manual integration, retain only the following three actions for the receiver's `intent-filter` --><receiverandroid:name="com.tencent.android.tpush.XGPushReceiver"android:exported="false"android:process=":xg_vip_service"><intent-filter android:priority="0x7fffffff" tools:node="replace" ><!-- **(Required)** The internal broadcast of the Tencent Push Notification Service 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><!-- When manually integrating the Mi channel, delete the `intent-filter` corresponding to the receiver --><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>
MavenCentral and Tencent Cloud image source in the allprojects.repositories file of your project's root directory build.gradle. Below is a code sample:allprojects {repositories {google()// Google-recommended image source `MavenCentral`mavenCentral()jcenter()// Tencent Cloud image sourcemaven { url 'https://mirrors.tencent.com/nexus/repository/maven-public/' }}}
onQueryTagsResult in the implementation class that inherits XGPushBaseReceiver. Below is a code sample:public class MessageReceiver extends XGPushBaseReceiver {// Other callback APIs// ...// Tag query callback APIpublic void onQueryTagsResult(Context context, int errorCode, String data, String operateName) {Log.i(LogTag, "action - onQueryTagsResult, errorCode:" + errorCode + ", operateName:" + operateName + ", data: " + data);}}
tpns-.jar files in the libs directory of the SDK package.so files for each platform in the Other-Platform-SO directory of the SDK package.application tag in the AndroidManifest file:<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="application package name.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="application package name"/><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="application package name.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 to the project with the following code: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; //This can be changed to a custom string resource ID}}
application tag in the AndroidManifest file:<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.** { *;}
Feedback