AppKey, AppSecret, and MasterSecret.AppKey, AppSecret, and MasterSecret parameters of the application into TPNS console > Configuration Management > Basic Configuration > OPPO Official Push Channel.default_messagedefault notification// For OPPO PUSH SDK, [VERSION] is the version number of the current SDK and can be obtained from the "SDK for Android".implementation 'com.tencent.tpns:oppo:[VERSION]-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'
Other-push-jar folder and import the OPPO PUSH-related JAR into the project.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}}
Androidmanifest.xml file :<!--Permissions required by OPPO PUSH--><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:// Note that OPPO's `AppKey` rather than the `AppID` is required hereXGPushConfig.setOppoPushAppId(getApplicationContext(), "OPPO’s AppKey");// Note that OPPO's `AppSecret` rather than the `AppKey` is required hereXGPushConfig.setOppoPushAppKey(getApplicationContext(), "OPPO’s AppSecret");// Enable third-party pushXGPushConfig.enableOtherPush(getApplicationContext(), true);// The log of successful registration is as follows: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.** { *;}
proguard-rules.pro file at the application project level.[OtherPushClient] handleUpdateToken other push token is: other push type: OPPO
OtherPush to view the return code logs, for example, [OtherPushOppoImpl] OppoPush Register failed, code=14, msg=INVALID_APP_KEY. Then locate the error cause and rectify the error by referring to Troubleshooting Vendor Channel Registration Failures.Apakah halaman ini membantu?
Anda juga dapat Menghubungi Penjualan atau Mengirimkan Tiket untuk meminta bantuan.
masukan