{"id":11054,"date":"2022-11-18T14:38:06","date_gmt":"2022-11-18T06:38:06","guid":{"rendered":"https:\/\/www.yimenapp.com\/kb-yimen\/?p=11054"},"modified":"2022-11-18T14:38:07","modified_gmt":"2022-11-18T06:38:07","slug":"oppo%e6%8e%a8%e9%80%81%e6%b6%88%e6%81%af%e8%83%bd%e5%8a%9bandroid-sdk%e9%9b%86%e6%88%90","status":"publish","type":"post","link":"https:\/\/www.yimenapp.com\/kb-yimen\/11054\/","title":{"rendered":"OPPO\u63a8\u9001\u6d88\u606f\u80fd\u529bAndroid SDK\u96c6\u6210"},"content":{"rendered":"\n<p>OPPO\u63a8\u9001\u6d88\u606f\u80fd\u529b<span class=\"wpcom_tag_link\"><a href=\"https:\/\/www.yimenapp.com\/kb-yimen\/tag\/android\/\" title=\"Android\" target=\"_blank\">Android<\/a><\/span> SDK\u96c6\u6210<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"header-1\"><strong>\u7248\u672c\u8bf4\u660e<\/strong><\/h2>\n\n\n\n<p>\u76ee\u524dSDK\u7248\u672c\u4e3aV3.1.0\uff0c\u4ec5\u652f\u6301ColorOS 3.1\u6216\u4ee5\u4e0a\u7248\u672c\u7684\u624b\u673a\u7cfb\u7edf\uff0c\u5982\u65e0\u7279\u6b8a\u8bf4\u660e\uff0c\u517c\u5bb9\u5386\u53f2\u7248\u672c\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"header-2\"><a><\/a><strong>SDK\u63a5\u5165\u6d41\u7a0b<\/strong><\/h2>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"header-3\"><a><\/a><strong>\u5f00\u901a\u63a8\u9001\u6743\u9650<\/strong><\/h3>\n\n\n\n<p>\u5177\u4f53\u6743\u9650\u7533\u8bf7\u6d41\u7a0b\u53ef\u53c2\u8003\u3010<a href=\"https:\/\/open.oppomobile.com\/new\/developmentDoc\/info?id=10195\" target=\"_blank\" rel=\"noreferrer noopener\">\u63a8\u9001\u670d\u52a1\u5f00\u542f\u6307\u5357<\/a>\u3011<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"header-4\"><a><\/a><strong>\u83b7\u53d6\u79d8\u94a5\u7b49\u9a8c\u8bc1\u4fe1\u606f<\/strong><\/h3>\n\n\n\n<p>\u7533\u8bf7\u901a\u8fc7\u540e\uff0c\u53ef\u5728OPPO\u63a8\u9001\u5e73\u53f0-\u914d\u7f6e\u7ba1\u7406-\u5e94\u7528\u914d\u7f6e-\u9875\u9762\u67e5\u770bAppKey\u3001AppSecret\u548cMasterSecret\uff08\u4ec5\u5f00\u53d1\u8005\u5e10\u53f7\uff08\u4e3b\u5e10\u53f7\uff09\u53ef\u67e5\u770b\uff09\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/kb.cdn.yimenapp.com\/yimen\/2022\/11\/20221118143806563.png\" alt=\"\u5ba2\u6237\u7aefSDK\u9875.png\"\/><\/figure>\n\n\n\n<p>\u540d\u8bcd\u89e3\u91ca\uff1aAppKey\u3001AppSecret\u5ba2\u6237\u7aef\u7684\u8eab\u4efd\u6807\u8bc6\uff0c\u5ba2\u6237\u7aefSDK\u521d\u59cb\u5316\u65f6\u4f7f\u7528\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"header-5\"><a><\/a><strong>SDK\u96c6\u6210\u6b65\u9aa4<\/strong><\/h2>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"header-6\"><a><\/a><strong>\u6ce8\u518c\u5e76\u4e0b\u8f7dSDK<\/strong><\/h3>\n\n\n\n<p>Android\u7684SDK\u4ee5aar\u5f62\u5f0f\u63d0\u4f9b\uff0c\u7b2c\u4e09\u65b9APP\u53ea\u9700\u8981\u6dfb\u52a0\u5c11\u91cf\u4ee3\u7801\u5373\u53ef\u63a5\u5165OPPO\u63a8\u9001\u670d\u52a1\u3002<br>\u4ee3\u7801\u53c2\u8003demo\u4e0b\u8f7d\uff1a<a href=\"https:\/\/openfs.oppomobile.com\/open\/oop\/202208\/04\/aab33b8e66b9500b2fc1b7666dc0aefe.zip\" target=\"_blank\" rel=\"noreferrer noopener\">heytapPushDemo<\/a><br>\u4e0b\u8f7daar\u6587\u4ef6\uff0c\u53733.1.0\u7248\u672csdk\uff1a<a href=\"https:\/\/openfs.oppomobile.com\/open\/oop\/202208\/04\/7ae060f5ac26e907d6e28a03ce095316.zip\" target=\"_blank\" rel=\"noreferrer noopener\">com.heytap.msp_3.1.0.aar<\/a><\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"header-7\"><a><\/a><strong>aar\u4f9d\u8d56<\/strong><\/h3>\n\n\n\n<p>\u7b2c\u4e00\u6b65\uff1a\u6dfb\u52a0maven\u4ed3\u5e93<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>repositories {\n    google()\n    mavenCentral()\n}\n<\/code><\/pre>\n\n\n\n<p>\u7b2c\u4e8c\u6b65\uff1a\u6dfb\u52a0maven\u4f9d\u8d56<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>implementation(name: 'com.heytap.msp_3.1.0', ext: 'aar')\n\/\/\u4ee5\u4e0b\u4f9d\u8d56\u90fd\u9700\u8981\u6dfb\u52a0\nimplementation 'com.google.code.gson:gson:2.6.2'\nimplementation 'commons-codec:commons-codec:1.6'\nimplementation 'com.android.support:support-annotations:28.0.0'(SDK\u4e2d\u7684\u63a5\u5165\u6700\u5c0f\u4f9d\u8d56\u9879\uff0c\u4e5f\u53ef\u4ee5\u53c2\u8003demo\u4e2d\u7684\u4f9d\u8d56)\n<\/code><\/pre>\n\n\n\n<p>\u7b2c\u4e09\u6b65\uff1a\u6dfb\u52a0aar\u914d\u7f6e<br>\u5728build\u6587\u4ef6\u4e2d\u6dfb\u52a0\u4ee5\u4e0b\u4ee3\u7801<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Android{\n....\n\nrepositories {\n    flatDir {\n        dirs 'libs'\n    }\n}\n\n....\n}\n<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"header-8\"><a><\/a><strong>\u914d\u7f6eAndroidManifest.xml<\/strong><\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>1)OPPO\u63a8\u9001\u670d\u52a1SDK\u652f\u6301\u7684\u6700\u4f4e\u5b89\u5353\u7248\u672c\u4e3aAndroid 4.4\u7cfb\u7edf\u3002\n&lt;uses-sdk  android:minSdkVersion=\"19\"\/&gt;\n \n2)\u63a8\u9001\u670d\u52a1\u7ec4\u4ef6\u6ce8\u518c\n\/\/\u5fc5\u987b\u914d\u7f6e\n&lt;service\n   android:name=\"com.heytap.msp.push.service.XXXService\"    \n  android:permission=\"com.heytap.mcs.permission.SEND_PUSH_MESSAGE\"\n android:exported=\"true\"&gt;\n    &lt;intent-filter&gt;\n     &lt;action android:name=\"com.heytap.mcs.action.RECEIVE_MCS_MESSAGE\"\/&gt; \n&lt;action android:name=\"com.heytap.msp.push.RECEIVE_MCS_MESSAGE\"\/&gt;\n    &lt;\/intent-filter&gt;\n&lt;\/service&gt;\uff08\u517c\u5bb9Q\u7248\u672c\uff0c\u7ee7\u627fDataMessageCallbackService\uff09\n \n&lt;service\n   android:name=\"com.heytap.msp.push.service.XXXService\"     \nandroid:permission=\"com.coloros.mcs.permission.SEND_MCS_MESSAGE\"\nandroid:exported=\"true\"&gt;\n    &lt;intent-filter&gt;\n     &lt;action android:name=\"com.coloros.mcs.action.RECEIVE_MCS_MESSAGE\"\/&gt;\n    &lt;\/intent-filter&gt;\n&lt;\/service&gt;\uff08\u517c\u5bb9Q\u4ee5\u4e0b\u7248\u672c\uff0c\u7ee7\u627fCompatibleDataMessageCallbackService\uff09\n<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"header-9\"><a><\/a><strong>\u6ce8\u518c\u63a8\u9001\u670d\u52a1<\/strong><\/h3>\n\n\n\n<p>1)\u5e94\u7528\u63a8\u8350\u5728Application\u7c7b\u4e3b\u8fdb\u7a0b\u4e2d\u8c03\u7528HeytapPushManager.init(\u2026)\u63a5\u53e3\uff0c\u8fd9\u4e2a\u65b9\u6cd5\u4e0d\u662f\u8017\u65f6\u64cd\u4f5c\uff0c\u6267\u884c\u4e4b\u540e\u624d\u80fd\u4f7f\u7528\u63a8\u9001\u670d\u52a1<br>2)\u4e1a\u52a1\u9700\u8981\u8c03\u7528api\u63a5\u53e3\uff0c\u4f8b\u5982\u5e94\u7528\u5185\u5f00\u5173\u5f00\u542f\/\u5173\u95ed\uff0c\u9700\u8981\u8c03\u7528\u6ce8\u518c\u63a5\u53e3\u4e4b\u540e\uff0c\u624d\u4f1a\u751f\u6548<br>3)\u7531\u4e8e\u4e0d\u662f\u6240\u6709\u5e73\u53f0\u90fd\u652f\u6301MSP PUSH\uff0c\u63d0\u4f9b\u63a5\u53e3HeytapPushManager.isSupportPush()\u65b9\u4fbf\u5e94\u7528\u5224\u65ad\u662f\u5426\u652f\u6301,\u652f\u6301\u624d\u80fd\u6267\u884c\u540e\u7eed\u64cd\u4f5c<br>4)\u901a\u8fc7\u8c03\u7528HeytapPushManager.register(\u2026)\u8fdb\u884c\u5e94\u7528\u6ce8\u518c\uff0c\u6ce8\u518c\u6210\u529f\u540e,\u60a8\u53ef\u4ee5\u5728ICallBackResultService\u7684onRegister\u56de\u8c03\u65b9\u6cd5\u4e2d\u5f97\u5230regId,\u60a8\u53ef\u4ee5\u5c06regId\u4e0a\u4f20\u5230\u81ea\u5df1\u7684\u670d\u52a1\u5668\uff0c\u65b9\u4fbf\u5411\u5176\u53d1\u6d88\u606f\u3002\u521d\u59cb\u5316\u76f8\u5173\u53c2\u6570\u5177\u4f53\u8981\u6c42\u53c2\u8003\u8be6\u7ec6API\u8bf4\u660e\u4e2d\u7684\u521d\u59cb\u5316\u90e8\u5206\u3002<br>5)\u4e3a\u4e86\u63d0\u9ad8push\u7684\u6ce8\u518c\u7387\uff0c\u4f60\u53ef\u4ee5\u5728Application\u7684onCreate\u4e2d\u521d\u59cb\u5316push\u3002\u4f60\u4e5f\u53ef\u4ee5\u6839\u636e\u9700\u8981\uff0c\u5728\u5176\u4ed6\u5730\u65b9\u521d\u59cb\u5316push\u3002\u5982\u679c\u7b2c\u4e00\u6b21\u6ce8\u518c\u5931\u8d25,\u7b2c\u4e8c\u6b21\u53ef\u4ee5\u76f4\u63a5\u8c03\u7528PushManager.getInstance().getRegister()\u8fdb\u884c\u91cd\u8bd5,\u6b64\u65b9\u6cd5\u9ed8\u8ba4\u4f1a\u4f7f\u7528\u7b2c\u4e00\u6b21\u4f20\u5165\u7684\u53c2\u6570\u6389\u8c03\u7528\u6ce8\u518c\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"header-10\"><a><\/a><strong>\u6df7\u6dc6\u914d\u7f6e<\/strong><\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>-keep public class * extends android.app.Service\n-keep class com.heytap.msp.** { *;}\n<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"header-11\"><a><\/a><strong>\u8be6\u7ec6API\u8bf4\u660e<\/strong><\/h2>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"header-12\"><a><\/a><strong>HeytapPushManager<\/strong><\/h3>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"header-13\"><a><\/a><strong>\u63a5\u53e3\u5b9a\u4e49<\/strong><\/h4>\n\n\n\n<pre class=\"wp-block-code\"><code>      \/**\n     *\u521d\u59cb\u5316MSP\u670d\u52a1\uff0c\u521b\u5efa\u9ed8\u8ba4\u901a\u9053\n     *@param context\u5fc5\u987b\u4f20\u5165\u5f53\u524dapp\u7684context\n     *@param needLog\u662f\u5426\u9700\u8981\u8bbe\u7f6elog\n     *\/\n        1\uff09void init (Context context\uff0cbool needLog)\n    \/**\n     *\u83b7\u53d6Mcs\u7684\u5305\u540d\n     *\/\n        2\uff09string getMcsPackageName ()\n\n    \/**\n     *\u83b7\u53d6\u63a5\u6536\u6d88\u606f\u670d\u52a1\u7684action\n     *\/\n        3\uff09string getReceiveSdkAction ()\n\n    \/**\n     *\u5224\u65ad\u662f\u5426\u624b\u673a\u5e73\u53f0\u662f\u5426\u652f\u6301PUSH\n     @param context\u4f20\u5165\u5e94\u7528\u4e0a\u4e0b\u6587\n     *@return true \u8868\u793a\u624b\u673a\u5e73\u53f0\u652f\u6301PUSH, false\u8868\u793a\u4e0d\u652f\u6301\n     *\/\n        4\uff09boolean isSupportPush (Context context)\n    \/**\n     * \uff08\u65e7\u57cb\u70b9\uff09\u6d88\u606f\u4e8b\u4ef6\u7edf\u8ba1\u63a5\u53e3\uff0c\u7528\u4e8e\u8fdb\u884c\u989d\u5916\u7684Push\u6d88\u606f\u4e8b\u4ef6\u7edf\u8ba1   *\n     * @param context \u5e94\u7528\u7684context\n     * @param message \u9700\u8981\u4e0a\u62a5\u7684\u6d88\u606f\u6216\u6d88\u606f\u5217\u8868\n     *\/\n    \/\/\u4f1a\u5728\u4ee5\u540e\u7684\u7248\u672c\u9010\u6e10\u5e9f\u5f03\n        5\uff09void statisticMessage (Context context, MessageStat message)\n        6\uff09void statisticMessage (Context context, List &lt; MessageStat &gt; messages)\n\n    \/**\n     * \uff08\u65b0\u57cb\u70b9\uff09\u6d88\u606f\u4e8b\u4ef6\u7edf\u8ba1\u63a5\u53e3\uff0c\u7528\u4e8e\u8fdb\u884c\u989d\u5916\u7684Push\u6d88\u606f\u4e8b\u4ef6\u7edf\u8ba1\uff0c\u5982\u6709\u9700\u8981\u4f7f\u7528\uff0c\u8bf7\u5f00\u53d1\u8005\u63d0\u524d\u4e0eOppoPush\u56e2\u961f\u8fdb\u884c\u5145\u5206\u6c9f\u901a\u548c\u786e\u8ba4,\u4e3a\u4e86\u9632\u6b62\u4e1a\u52a1\u65b9\u9891\u7e41\u8c03\u7528\u4e0a\u62a5\n     *\n     * @param context \u5e94\u7528\u7684context\n     * @param eventId \u9700\u8981\u4e0a\u62a5\u7684eventId\u4e8b\u4ef6\uff0c\u4e0a\u62a5\u7684eventId\u5728EventConstant\u7c7b\u4e2d\n     *\n        7\uff09void statisticEvent(Context context,String eventId , DataMessage message)\n\n    \/**\n     *\u83b7\u53d6registerId\n     *\/\n        8\uff09String getRegisterID ()\n\n    \/**\n     *\u8bbe\u7f6eregisterId\n     *\/\n        9\uff09void setRegisterID (String mRegisterID)\n\n    \/**\n     * \u6ce8\u518cMSP\u63a8\u9001\u670d\u52a1\n     * @param applicatoinContext\u5fc5\u987b\u4f20\u5165\u5f53\u524dapp\u7684applicationcontet\n     * @param appKey \u5728\u5f00\u53d1\u8005\u7f51\u7ad9\u4e0a\u6ce8\u518c\u65f6\u751f\u6210\u7684\uff0c\u4e0eAppKey\u76f8\u5bf9\u5e94\n     * @param appSecret \u4e0eAppSecret\u76f8\u5bf9\u5e94\n     * @param ICallBackResultService SDK\u64cd\u4f5c\u7684\u56de\u8c03\n     *\/\n        10\uff09void register (Context applicatoinContext, String appKey, String appSecret, ICallBackResultService\n            ICallBackResultService );\n\n    \/**\n     * \u8bbe\u7f6eappKey\u7b49\u53c2\u6570,\u53ef\u4ee5\u8986\u76d6register\u4e2d\u7684appkey\u8bbe\u7f6e\n     * @param appKey \u5728\u5f00\u53d1\u8005\u7f51\u7ad9\u4e0a\u6ce8\u518c\u65f6\u751f\u6210\u7684key\n     * @param appSecret\n     *\/\n        11\uff09void setAppKeySecret (String appKey, String appSecret);\n\n    \/**\n     *\u83b7\u53d6pushcall\u56de\u8c03\n     *\/\n        12\uff09ICallBackResultService getPushCallback ()\n\n    \/**\n     * \u8bbe\u7f6esdk\u64cd\u4f5c\u56de\u8c03\u5904\u7406,\u53ef\u4ee5\u8986\u76d6register\u4e2d\u7684ICallBackResultService\u8bbe\u7f6e\n     * @param ICallBackResultService sdk\u64cd\u4f5c\u56de\u8c03\u5904\u7406\n     *\/\n        13\uff09void setPushCallback (ICallBackResultService ICallBackResultService );\n\n\n    \/**\n     * \u89e3\u6ce8\u518cMSP\u63a8\u9001\u670d\u52a1\n     *\/\n        14\uff09void unRegister ();\n\n    \/**\n     * \u83b7\u53d6\u6ce8\u518cOPush\u63a8\u9001\u670d\u52a1\u7684\u6ce8\u518cID,\u6b64\u65b9\u6cd5\u7528\u4e8e\u63d0\u9ad8\u6ce8\u518c\u7387\uff0c\u91cc\u9762\u8c03\u7528\u7684\u662f\u6ce8\u518c\u7684\u903b\u8f91\uff0c\u5f15\u7528\u4e4b\u524d\u4f20\u5165\u7684\u53c2\u6570\n     *\/\n        15\uff09void getRegister ()\n\n    \/**\n     * \u6682\u505c\u63a5\u6536MSP\u670d\u52a1\u63a8\u9001\u7684\u6d88\u606f\n     *\/\n        16\uff09void pausePush ();\n\n    \/**\n     * \u6062\u590d\u63a5\u6536MSP\u670d\u52a1\u63a8\u9001\u7684\u6d88\u606f\uff0c\u8fd9\u65f6\u670d\u52a1\u5668\u4f1a\u628a\u6682\u505c\u65f6\u671f\u7684\u63a8\u9001\u6d88\u606f\u91cd\u65b0\u63a8\u9001\u8fc7\u6765\n     *\/\n        17\uff09void resumePush ();\n\n    \/**\n     * \u6e05\u9664\u901a\u77e5\n     *\/\n        18\uff09void clearNotifications ()\n\n    \/**\n     * \u83b7\u53d6MSP\u63a8\u9001\u670d\u52a1\u72b6\u6001\n     *\/\n       19\uff09void getPushStatus ();\n\n    \/**\n     * \u83b7\u53d6MSP\u63a8\u9001\u670d\u52a1SDK\u7248\u672c\uff08\u4f8b\u5982\u201d2.1.0\u201d\uff09\n     *\n     * @return SDKVersion\n     *\/\n       20\uff09String getSDKVersionCode ();\n\n    \/**\n     * \u83b7\u53d6MSP\u63a8\u9001\u670d\u52a1SDK\u540d\u79f0\n     *\n     * @return SDKVersionName\n     *\/\n        21\uff09String getSDKVersionName ();\n\n    \/**\n     * \u83b7\u53d6MSP\u63a8\u9001\u670d\u52a1MCS\u7248\u672c(\u4f8b\u5982\u201c2400\u201d)\n     *\n     * @return PushVersionCode\n     *\/\n        22\uff09String getPushVersionCode ();\n\n    \/**\n     * \u83b7\u53d6MSP\u63a8\u9001\u670d\u52a1MCS\u7248\u672c(\u4f8b\u5982\u201c2.4.0\u201d)\n     *\n     * @return PushVersionName\n     *\/\n        23\uff09String getPushVersionName ();\n\n    \/**\n     * \u8bbe\u7f6e\u5141\u8bb8\u63a8\u9001\u65f6\u95f4 API\n     *\n     * @param weekDays \u5468\u65e5\u4e3a0,\u5468\u4e00\u4e3a1,\u4ee5\u6b64\u7c7b\u63a8\n     * @param startHour \u5f00\u59cb\u65f6\u95f4,24\u5c0f\u65f6\u5236\n     * @param endHour \u7ed3\u675f\u65f6\u95f4,24\u5c0f\u65f6\u5236\n     *\/\n        24\uff09void setPushTime (List&lt; Integer &gt; weekDays, int startHour, int start Min, int endHour, int endMin);\n\n    \/**\n     * \u5f39\u51fa\u901a\u77e5\u680f\u6743\u9650\u5f39\u7a97\uff08\u4ec5\u4e00\u6b21\uff09\uff0cOS12.1\u53ca\u4e4b\u540e\u7684ColorOS\u7248\u672c\u5e9f\u5f03\u8be5\u63a5\u53e3\uff0c\u4e0d\u751f\u6548\n     *\/\n        25\uff09void requestNotificationPermission ();\n\n    \/**\n     * \u6253\u5f00\u901a\u77e5\u680f\u8bbe\u7f6e\u754c\u9762\n     *\/\n        26\uff09void openNotificationSetting ();\n\n    \/**\n     * \u83b7\u53d6\u901a\u77e5\u680f\u72b6\u6001\uff0c\u4ececallbackresultservice\u56de\u8c03\u7ed3\u679c\n     *\/\n        27\uff09void getNotificationStatus ();\n\n    \/**\n     * \u6253\u5f00\u5e94\u7528\u5185\u901a\u77e5\n     *@see ISetAppNotificationCallBackService\n     *\/\n        28\uff09void enableAppNotificationSwitch (ISetAppNotificationCallBackService callBackService);\n\n    \/**\n     * \u5173\u95ed\u5e94\u7528\u5185\u901a\u77e5\n     *@see ISetAppNotificationCallBackService\n     *\/\n        29\uff09void disableAppNotificationSwitch (ISetAppNotificationCallBackService callBackService);\n\n    \/**\n     * \u83b7\u53d6\u5e94\u7528\u5185\u901a\u77e5\u5f00\u5173\n     *@see IGetAppNotificationCallBackService\n     *\/\n        30\uff09void getAppNotificationSwitch (IGetAppNotificationCallBackService callBackService);\n\n<\/code><\/pre>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"header-14\"><a><\/a><strong>\u63a5\u53e3\u8bf4\u660e<\/strong><\/h4>\n\n\n\n<p>\u5e94\u7528\u5728\u6ca1\u6709\u83b7\u53d6\u5230registerId\u65f6,\u9700\u8981\u5148\u8c03\u7528register\u8fdb\u884c\u6ce8\u518c,\u6ce8\u518c\u6210\u529f\u540e\u624d\u53ef\u4ee5\u8fdb\u884c\u540e\u7eed\u64cd\u4f5c\u3002\u5982\u679c\u8c03\u7528register\u6ce8\u518c\u5931\u8d25,\u53ef\u4ee5\u8c03\u7528getRegister\u4f7f\u7528\u4e0a\u4e00\u6b21\u4f20\u5165\u7684\u53c2\u6570\u8fdb\u884c\u91cd\u8bd5\u3002<br>\u8c03\u7528requestNotificationPermission\u663e\u793a\u901a\u77e5\u6743\u9650\u5f39\u7a97\uff0c\u7528\u6237\u53ef\u901a\u8fc7\u5f39\u7a97\u81ea\u884c\u9009\u62e9\u662f\/\u5426\u6253\u5f00\u5e94\u7528\u7684\u901a\u77e5\u6743\u9650\u3002\u5efa\u8bae\u5728Activity\u7684onResume\u65b9\u6cd5\u4e2d\u8c03\u7528\u8be5\u63a5\u53e3\u4ee5\u907f\u514d\u548c\u5176\u4ed6\u5f39\u7a97\u91cd\u53e0\u3002\u91cd\u590d\u8c03\u7528\u8be5\u63a5\u53e3\uff0c\u5f39\u7a97\u4e5f\u4ec5\u4f1a\u663e\u793a\u4e00\u6b21\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"header-15\"><a><\/a><strong>ICallBackResultService<\/strong><\/h3>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"header-16\"><a><\/a><strong>\u63a5\u53e3\u5b9a\u4e49<\/strong><\/h4>\n\n\n\n<pre class=\"wp-block-code\"><code>\/\/\u6ce8\u518c\u7684\u7ed3\u679c,\u5982\u679c\u6ce8\u518c\u6210\u529f,registerID\u5c31\u662f\u5ba2\u6237\u7aef\u7684\u552f\u4e00\u8eab\u4efd\u6807\u8bc6\nvoid onRegister(int responseCode, String registerID);\n\n\/\/\u53cd\u6ce8\u518c\u7684\u7ed3\u679c\nvoid onUnRegister(int responseCode);\n \n\/\/\u83b7\u53d6\u5f53\u524d\u7684push\u72b6\u6001\u8fd4\u56de,\u6839\u636e\u8fd4\u56de\u7801\u5224\u65ad\u5f53\u524d\u7684push\u72b6\u6001,\u8fd4\u56de\u7801\u5177\u4f53\u542b\u4e49\u53ef\u4ee5\u53c2\u8003&#91;\u9519\u8bef\u7801]\nvoid onGetPushStatus(int responseCode,int status);\npublic class PushStatus {\n    public static final int PUSH_STATUS_START = 0;\n    public static final int PUSH_STATUS_PAUSE = 1;\n    public static final int PUSH_STATUS_STOP = 2;\n}\n \n\/\/\u83b7\u53d6\u5f53\u524d\u901a\u77e5\u680f\u72b6\u6001\uff0c\u8fd4\u56de\u7801\u5177\u4f53\u542b\u4e49\u53ef\u4ee5\u53c2\u8003&#91;\u9519\u8bef\u7801]\nvoid onGetNotificationStatus(int responseCode,int status);\npublic class NotificatoinStatus {\n    public static final int STATUS_OPEN = 0;\n    public static final int STATUS_CLOSE = 1;\n}\n \n\/\/\u83b7\u53d6\u8bbe\u7f6e\u63a8\u9001\u65f6\u95f4\u7684\u6267\u884c\u7ed3\u679c\nvoid onSetPushTime(int responseCode, String pushTime)\n \n\/\/\u9519\u8bef\u7801\u8fd4\u56de\u7684\u63a5\u53e3(\u5f53\u524d\u4e3b\u8981\u662f\u7528\u4e8e\u8c03\u7528\u9891\u7e41\u7684\u56de\u8c03\uff0c\u540e\u7eed\u53ef\u505a\u62d3\u5c55)\nvoid onError(int code, String msg)\n<\/code><\/pre>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"header-17\"><a><\/a><strong>\u63a5\u53e3\u8bf4\u660e<\/strong><\/h4>\n\n\n\n<p>\u6240\u6709\u56de\u8c03\u90fd\u9700\u8981\u6839\u636eresponseCode\u6765\u5224\u65ad\u64cd\u4f5c\u662f\u5426\u6210\u529f\uff0c0 \u4ee3\u8868\u6210\u529f,\u5176\u4ed6\u4ee3\u7801\u5931\u8d25\uff0c\u5931\u8d25\u5177\u4f53\u539f\u56e0\u53ef\u4ee5\u67e5\u9605\u9644\u5f55\u4e2d\u7684\u9519\u8bef\u7801\u5217\u8868\u3002<br>onRegister\u63a5\u53e3\u8fd4\u56de\u7684registerID\u662f\u5f53\u524d\u5ba2\u6237\u7aef\u7684\u552f\u4e00\u6807\u8bc6\uff0c<span class=\"wpcom_keyword_link\"><a href=\"https:\/\/www.yimenapp.com\" target=\"_blank\" title=\"\u5f00\u53d1app\u4ece\u4e00\u95e8\u5f00\u59cb\">app<\/a><\/span>\u5f00\u53d1\u8005\u53ef\u4ee5\u4e0a\u4f20\u4fdd\u5b58\u5230\u5e94\u7528\u670d\u52a1\u5668\u4e2d,\u5728\u53d1\u9001push\u6d88\u606f\u662f\u53ef\u4ee5\u6307\u5b9aregisterID\u53d1\u9001\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"header-18\"><a><\/a><strong>ISetAppNotificationCallBackService<\/strong><\/h3>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"header-19\"><a><\/a><strong>\u63a5\u53e3\u5b9a\u4e49<\/strong><\/h4>\n\n\n\n<p>\/\/\u8bbe\u7f6e\u5e94\u7528\u5185\u901a\u77e5\u5f00\u5173\u7ed3\u679c,\u5982\u679c\u6210\u529f\u8fd4\u56de0\uff0c\u5931\u8d25\u8fd4\u56de\u975e0\uff0c\u5177\u4f53\u6307\u53c2\u8003\u9519\u8bef\u7801<br>void onSetAppNotificationSwitch(int responseCode);<\/p>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"header-20\"><a><\/a><strong>\u63a5\u53e3\u8bf4\u660e<\/strong><\/h4>\n\n\n\n<p>\u5efa\u8bae\u590d\u7528\u4f7f\u7528\u4e00\u4e2acallBackService\uff0c\u907f\u514d\u540e\u9762\u5bf9\u8c61\u8986\u76d6\u8c03\u524d\u9762\u4e00\u4e2a\u5bf9\u8c61\u5bfc\u81f4\u524d\u9762\u7684callBackService\u65e0\u8fd4\u56de\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"header-21\"><a><\/a><strong>IGetAppNotificationCallBackService<\/strong><\/h3>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"header-22\"><a><\/a><strong>\u63a5\u53e3\u5b9a\u4e49<\/strong><\/h4>\n\n\n\n<pre class=\"wp-block-code\"><code>\/\/\u83b7\u53d6\u5e94\u7528\u5185\u901a\u77e5\u5f00\u5173\u7ed3\u679c,\u5982\u679c\u6210\u529f\u8fd4\u56de0\uff0c\u5931\u8d25\u8fd4\u56de\u975e0\uff0c\u5177\u4f53\u6307\u53c2\u8003\u9519\u8bef\u7801\n\/\/appSwich\uff1a0\uff1a\u672a\u5b9a\u4e49\u72b6\u6001\uff08\u4e0d\u6821\u9a8c\u5f00\u5173\uff09\uff0c1\uff1a\u6253\u5f00\u72b6\u6001\uff0c2\uff1a\u5173\u95ed\u72b6\u6001\nvoid onGetAppNotificationSwitch(int responseCode, int appSwitch);\n<\/code><\/pre>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"header-23\"><a><\/a><strong>\u63a5\u53e3\u8bf4\u660e<\/strong><\/h4>\n\n\n\n<p>\u5efa\u8bae\u590d\u7528\u4f7f\u7528\u4e00\u4e2acallBackService\uff0c\u907f\u514d\u540e\u9762\u5bf9\u8c61\u8986\u76d6\u8c03\u524d\u9762\u4e00\u4e2a\u5bf9\u8c61\u5bfc\u81f4\u524d\u9762\u7684callBackService\u65e0\u8fd4\u56de\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"header-24\"><a><\/a><strong>\u6027\u80fd\u6307\u6807\u548cSDK\u5305\u5927\u5c0f<\/strong><\/h2>\n\n\n\n<p>1)\u6027\u80fd\u6307\u6807\uff1a\u54cd\u5e94\u65f6\u95f4\u5c0f\u4e8e500\u6beb\u79d2<br>2)sdk\u5305\u5927\u5c0f\uff1a500kb\u4ee5\u5185<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u76ee\u524dSDK\u7248\u672c\u4e3aV3.1.0\uff0c\u4ec5\u652f\u6301ColorOS 3.1\u6216\u4ee5\u4e0a\u7248\u672c\u7684\u624b\u673a\u7cfb\u7edf\uff0c\u5982\u65e0\u7279\u6b8a\u8bf4\u660e\uff0c\u517c\u5bb9\u5386\u53f2\u7248\u672c\u3002<\/p>\n","protected":false},"author":1,"featured_media":11055,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[46],"tags":[465,5185,5186,5184,5183,5182],"special":[65],"attr":[],"class_list":{"0":"post-11054","1":"post","2":"type-post","3":"status-publish","4":"format-standard","5":"has-post-thumbnail","6":"hentry","7":"category-appsj","8":"tag-android","12":"tag-opposdk","14":"special-oppokfpt","15":"entry"},"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/www.yimenapp.com\/kb-yimen\/wp-json\/wp\/v2\/posts\/11054","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.yimenapp.com\/kb-yimen\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.yimenapp.com\/kb-yimen\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.yimenapp.com\/kb-yimen\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.yimenapp.com\/kb-yimen\/wp-json\/wp\/v2\/comments?post=11054"}],"version-history":[{"count":1,"href":"https:\/\/www.yimenapp.com\/kb-yimen\/wp-json\/wp\/v2\/posts\/11054\/revisions"}],"predecessor-version":[{"id":11056,"href":"https:\/\/www.yimenapp.com\/kb-yimen\/wp-json\/wp\/v2\/posts\/11054\/revisions\/11056"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.yimenapp.com\/kb-yimen\/wp-json\/wp\/v2\/media\/11055"}],"wp:attachment":[{"href":"https:\/\/www.yimenapp.com\/kb-yimen\/wp-json\/wp\/v2\/media?parent=11054"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.yimenapp.com\/kb-yimen\/wp-json\/wp\/v2\/categories?post=11054"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.yimenapp.com\/kb-yimen\/wp-json\/wp\/v2\/tags?post=11054"},{"taxonomy":"special","embeddable":true,"href":"https:\/\/www.yimenapp.com\/kb-yimen\/wp-json\/wp\/v2\/special?post=11054"},{"taxonomy":"attr","embeddable":true,"href":"https:\/\/www.yimenapp.com\/kb-yimen\/wp-json\/wp\/v2\/attr?post=11054"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}