// OPPO 推送 SDK,[VERSION] 为当前 SDK 版本号,版本号可在 Android SDK 发布动态查看implementation 'com.tencent.tpns:oppo:[VERSION]-release'// 自 SDK 1.3.2.0 起,需一并加入以下依赖语句,否则可能导致 OPPO 推送注册失败implementation 'com.google.code.gson:gson:2.6.2'implementation 'commons-codec:commons-codec:1.15'
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}}
Androidmanifest.xml 文件中新增如下配置:<!--OPPO 推送服务必须权限--><uses-permission android:name="com.coloros.mcs.permission.RECIEVE_MCS_MESSAGE"/><uses-permission android:name="com.heytap.mcs.permission.RECIEVE_MCS_MESSAGE"/><application><serviceandroid:name="com.heytap.msp.push.service.CompatibleDataMessageCallbackService"android:permission="com.coloros.mcs.permission.SEND_MCS_MESSAGE"android:exported="true"><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"android:exported="true"><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></application>
XGPushManager.registerPush之前,调用以下代码:// 注意这里填入的是 Oppo 的 AppKey,不是AppIdXGPushConfig.setOppoPushAppId(getApplicationContext(), "Oppo的AppKey");// 注意这里填入的是 Oppo 的 AppSecret,不是 AppKeyXGPushConfig.setOppoPushAppKey(getApplicationContext(), "Oppo的AppSecret");//打开第三方推送XGPushConfig.enableOtherPush(getApplicationContext(), true);//注册成功的日志如下I/TPush: [RegisterReservedInfo] Reservert info: other push token is : CN_fc0f0b38220cba7a1bcbda20857e021b other push type: oppoI/TPush: [PushServiceBroadcastHandler] >> bind OtherPushToken success ack with [accId = 150000**** , rsp = 0] token = 007a4105425********52ac1e1360c6780f3 otherPushType = oppo otherPushToken = CN_fc0f0b3822****7a1bcbda20857e021b
-keep public class * extends android.app.Service-keep class com.heytap.mcssdk.** {*;}-keep class com.heytap.msp.push.** { *;}
[OtherPushClient] handleUpdateToken other push token is : other push type: OPPO
[OtherPushOppoImpl] OppoPush Register failed, code=14, msg=INVALID_APP_KEY),并前往 厂商通道注册失败排查指南 查找对应原因,获取解决办法。文档反馈