{"id":11074,"date":"2022-11-18T14:46:10","date_gmt":"2022-11-18T06:46:10","guid":{"rendered":"https:\/\/www.yimenapp.com\/kb-yimen\/?p=11074"},"modified":"2022-11-18T14:46:10","modified_gmt":"2022-11-18T06:46:10","slug":"oppo%e6%8e%a8%e9%80%81%e6%9c%8d%e5%8a%a1%e7%ab%af-java-sdk%e9%9b%86%e6%88%90","status":"publish","type":"post","link":"https:\/\/www.yimenapp.com\/kb-yimen\/11074\/","title":{"rendered":"OPPO\u63a8\u9001\u670d\u52a1\u7aef Java SDK\u96c6\u6210"},"content":{"rendered":"\n<p><span class=\"wpcom_tag_link\"><a href=\"https:\/\/www.yimenapp.com\/kb-yimen\/tag\/oppo%e6%8e%a8%e9%80%81%e6%9c%8d%e5%8a%a1\/\" title=\"OPPO\u63a8\u9001\u670d\u52a1\" target=\"_blank\">OPPO\u63a8\u9001\u670d\u52a1<\/a><\/span>\u7aef Java SDK\u96c6\u6210<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"header-1\"><strong>\u63a5\u5165\u51c6\u5907<\/strong><\/h2>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"header-2\"><a><\/a><strong>\u8fd0\u884c\u73af\u5883<\/strong><\/h3>\n\n\n\n<p>SDK\u4f7f\u7528Java\u7f16\u5199\uff0c\u63a5\u5165\u524d\u9700\u786e\u8ba4\u662f\u5426\u5b89\u88c5Java\u73af\u5883\u5e76\u4e14\u7248\u672c\u4e3a1.7\u53ca\u4ee5\u4e0a<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"header-3\"><a><\/a><strong>\u83b7\u53d6SDK<\/strong><\/h3>\n\n\n\n<p>1\uff09\u5f00\u53d1\u8005\u9700\u8981\u767b\u5f55<a href=\"https:\/\/open.oppomobile.com\/opush\/top\/application-list\" target=\"_blank\" rel=\"noreferrer noopener\">\u63a8\u9001\u8fd0\u8425\u5e73\u53f0<\/a>\u83b7\u53d6\u5e94\u7528\u7684AppKey, MasterSecret<br>2\uff09\u4e0b\u8f7dSDK\u76f8\u5173\u5305\uff1a<a href=\"https:\/\/openfs.oppomobile.com\/open\/oop\/202208\/29\/690e720af364650495c3d272495ca207.zip\" target=\"_blank\" rel=\"noreferrer noopener\">OPush_JAVA_SDK.zip<\/a><\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"header-4\"><a><\/a><strong>\u5bfc\u5165SDK<\/strong><\/h3>\n\n\n\n<p>1\uff09\u89e3\u538b\u5df2\u4e0b\u8f7d\u7684SDK\u5305<br>2\uff09\u5c06\u6587\u4ef6\u5939\u4e0b\u6240\u6709jar\u6587\u4ef6\u653e\u5165\u9879\u76ee\u5de5\u7a0b\u7684libs\u76ee\u5f55<br>3\uff09\u5237\u65b0\u5de5\u7a0b\uff0c\u786e\u4fdd\u6587\u4ef6\u51fa\u73b0\u5728libs\u76ee\u5f55\u4e0b\u3002\u5982\u679c\u6ca1\u6709\u7684\u8bdd\u8bf7\u624b\u52a8\u6dfb\u52a0<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"header-5\"><a><\/a><strong>SDK\u7c7b\u5b9a\u4e49\u8bf4\u660e<\/strong><\/h3>\n\n\n\n<figure class=\"wp-block-table\"><table><thead><tr><th>\u7c7b\u540d<\/th><th>\u4f7f\u7528\u8bf4\u660e<\/th><\/tr><\/thead><tbody><tr><td><span class=\"wpcom_tag_link\"><a href=\"https:\/\/www.yimenapp.com\/kb-yimen\/tag\/sender\/\" title=\"Sender\" target=\"_blank\">Sender<\/a><\/span><\/td><td>\u53d1\u9001\u6d88\u606f\u5de5\u5177\u7c7b\uff0c\u53ef\u4ee5\u53d1\u9001\u5355\u63a8\u3001\u6279\u91cf\u5355\u63a8\u3001\u5e7f\u64ad\u6d88\u606f<\/td><\/tr><tr><td>Environment<\/td><td>\u679a\u4e3e\u7c7b<br>Environment.CHINA_PRODUCTION \u4e2d\u56fd<br>Environment.INTERNATIONAL \u6d77\u5916<\/td><\/tr><tr><td>Notification<\/td><td>\u901a\u77e5\u680f\u6d88\u606f<\/td><\/tr><tr><td>Target<\/td><td>\u63a8\u9001\u76ee\u6807\u7c7b\uff0c\u5305\u542b\u63a8\u9001\u76ee\u6807\u7c7b\u578b\u3001\u63a8\u9001\u76ee\u6807<\/td><\/tr><tr><td>TargetType<\/td><td>\u63a8\u9001\u76ee\u6807\u7c7b\u578b\uff0c\u652f\u6301registration_id\u63a8\u9001\u7c7b\u578b<\/td><\/tr><tr><td>Result<\/td><td>\u670d\u52a1\u5668\u8fd4\u56de\u7684\u7ed3\u679c<\/td><\/tr><tr><td>ReturnCode<\/td><td>\u8fd4\u56de\u7684\u72b6\u6001\u7801\uff0c\u6839\u636e\u8fd9\u4e2a\u72b6\u6001\u53ef\u4ee5\u81ea\u68c0\u8bf7\u6c42\u53c2\u6570\u7684\u662f\u5426\u5408\u6cd5<\/td><\/tr><tr><td>ReturnCode.ErrorCode<\/td><td>\u5e73\u53f0\u8fd4\u56de\u7684\u72b6\u6001\u7801\u679a\u4e3e\u7c7b<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p>\u8be6\u60c5\u89c1<a href=\"https:\/\/push.oppo.com\/open-doc\/opush_java_sdk\/apidocs\/index.html\" target=\"_blank\" rel=\"noreferrer noopener\">SDK javadoc<\/a>\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"header-6\"><a><\/a><strong>\u63a5\u5165SDK\u793a\u8303<\/strong><\/h2>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"header-7\"><a><\/a><strong>\u521b\u5efasender\u5bf9\u8c61<\/strong><\/h3>\n\n\n\n<p>SDK\u63d0\u4f9bSender\u7c7b\u5c01\u88c5\u4e86OPPO Push\u63a8\u9001\u670d\u52a1\u7684\u5404\u7c7b\u670d\u52a1\u63a5\u53e3\u3002\u56e0\u6b64\uff0c\u4f7f\u7528SDK\u63a8\u9001\u6d88\u606f\u6216\u8c03\u7528\u5176\u4ed6\u670d\u52a1\uff0c\u9996\u5148\u8981\u521b\u5efaSender\u5bf9\u8c61\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\/\/ \u4f7f\u7528appKey, masterSecret\u521b\u5efasender\u5bf9\u8c61\uff08\u6bcf\u6b21\u53d1\u9001\u6d88\u606f\u90fd\u4f7f\u7528\u8fd9\u4e2asender\u5bf9\u8c61\uff09\nSender sender = Sender.newBuilder()\n        .appKey(\"appKey\") \/\/ \u8bbe\u7f6eappKey\n        .masterSecret(\"masterSecret\") \/\/ \u8bbe\u7f6emasterSecret\n        .env(Environment.CHINA_PRODUCTION)  \/\/ \u4e2d\u56fd\n        .httpMaxConnection(64) \/\/ \u8bbe\u7f6ehttp\u6700\u5927\u8fde\u63a5\u6570\n        .httpMaxRoute(64)   \/\/ \u8bbe\u7f6e\u6700\u5927http\u8def\u7531\u8fde\u63a5\u6570\n        .httpConnectionTimeout(5000) \/\/ http\u8fde\u63a5\u8d85\u65f6\u65f6\u95f4\n        .httpConnectRequestTimeout(5000) \/\/ \u7b49\u5f85\u8fde\u63a5\u8d85\u65f6\u65f6\u95f4\n        .httpSocketTimeout(5000) \/\/ socket\u8d85\u65f6\u65f6\u95f4\n        .build();\n<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"header-8\"><a><\/a><strong>\u63a8\u9001\u6d88\u606f<\/strong><\/h3>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"header-9\"><a><\/a><strong>\u521b\u5efa\u901a\u77e5\u680f\u6d88\u606f\u4f53<\/strong><\/h4>\n\n\n\n<p>\u63a8\u9001\u6d88\u606f\u524d\uff0c\u9700\u8981\u6784\u9020\u6d88\u606f\u5185\u5bb9\uff0cSDK\u63d0\u4f9bNotification\u7c7b\u4f9b\u5f00\u53d1\u8005\u8bbe\u7f6e\u6d88\u606f\u5185\u5bb9\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\/**\n * \u8fd9\u662f\u6784\u9020\u4e00\u4e2a\u901a\u77e5\u680f\u6d88\u606f\u4f53Notification\u5bf9\u8c61\u7684\u5b9e\u4f8b\u65b9\u6cd5\u3002\n * \u8bf7\u6ce8\u610f\uff0c\u540e\u7eed\u7684\u4f8b\u5b50\u4f1a\u8c03\u7528\u8fd9\u4e2agetNotification()\u65b9\u6cd5\n * *\/\nprivate Notification getNotification() {\n    Notification notification = new Notification();\n    \n    \/\/ \u6807\u9898\uff0c\u5185\u5bb9\u662f\u5fc5\u586b\u9879\n    notification.setTitle(\"\u901a\u77e5\u680f\u6d88\u606ftile\");\n    notification.setContent(\"\u901a\u77e5\u680f\u5185\u5bb9\");\n\n    \/*\n     * \u4ee5\u4e0b\u53c2\u6570\u975e\u5fc5\u586b\u9879\uff0c\u53c2\u8003OPPO push\u670d\u52a1\u7aefapi\u6587\u6863\u8fdb\u884c\u8bbe\u7f6e\uff0c\u672c\u793a\u4f8b\u9009\u53d6\u90e8\u5206\u53c2\u6570\u8fdb\u884c\u793a\u8303\n     *\/\n    \/\/\u901a\u77e5\u680f\u6837\u5f0f 1. \u6807\u51c6\u6837\u5f0f  2. \u957f\u6587\u672c\u6837\u5f0f  3. \u5927\u56fe\u6837\u5f0f \u3010\u975e\u5fc5\u586b\uff0c\u9ed8\u8ba41-\u6807\u51c6\u6837\u5f0f\u3011\n    notification.setStyle(1);\n    \/\/ App\u5f00\u53d1\u8005\u81ea\u5b9a\u4e49\u6d88\u606fId\uff0cOPPO\u63a8\u9001\u5e73\u53f0\u6839\u636e\u6b64ID\u505a\u53bb\u91cd\u5904\u7406\uff0c\u5bf9\u4e8e\u5e7f\u64ad\u63a8\u9001\u76f8\u540cappMessageId\u53ea\u4f1a\u4fdd\u5b58\u4e00\u6b21\uff0c\u5bf9\u4e8e\u5355\u63a8\u76f8\u540cappMessageId\u53ea\u4f1a\u63a8\u9001\u4e00\u6b21\n    notification.setAppMessageId(UUID.randomUUID().toString());\n    \/\/ \u5e94\u7528\u63a5\u6536\u6d88\u606f\u5230\u8fbe\u56de\u6267\u7684\u56de\u8c03URL\uff0c\u5b57\u6570\u9650\u5236200\u4ee5\u5185\uff0c\u4e2d\u82f1\u6587\u5747\u4ee5\u4e00\u4e2a\u8ba1\u7b97\n    notification.setCallBackUrl(\"http:\/\/www.test.com\");\n    \/\/ App\u5f00\u53d1\u8005\u81ea\u5b9a\u4e49\u56de\u6267\u53c2\u6570\uff0c\u5b57\u6570\u9650\u523650\u4ee5\u5185\uff0c\u4e2d\u82f1\u6587\u5747\u4ee5\u4e00\u4e2a\u8ba1\u7b97\n    notification.setCallBackParameter(\"\");\n    \/\/ \u70b9\u51fb\u52a8\u4f5c\u7c7b\u578b0\uff0c\u542f\u52a8\u5e94\u7528\uff1b1\uff0c\u6253\u5f00\u5e94\u7528\u5185\u9875\uff08activity\u7684intent action\uff09\uff1b2\uff0c\u6253\u5f00\u7f51\u9875\uff1b4\uff0c\u6253\u5f00\u5e94\u7528\u5185\u9875\uff08activity\uff09\uff1b\u3010\u975e\u5fc5\u586b\uff0c\u9ed8\u8ba4\u503c\u4e3a0\u3011;5,Intent scheme URL\n    notification.setClickActionType(4);\n    \/\/ \u5e94\u7528\u5185\u9875\u5730\u5740\u3010click_action_type\u4e3a1\u62164\u65f6\u5fc5\u586b\uff0c\u957f\u5ea6500\u3011\n    notification.setClickActionActivity(\"com.coloros.push.demo.component.InternalActivity\");\n    \/\/ \u7f51\u9875\u5730\u5740\u3010click_action_type\u4e3a2\u5fc5\u586b\uff0c\u957f\u5ea6500\u3011\n    notification.setClickActionUrl(\"http:\/\/www.test.com\");\n    \/\/ \u52a8\u4f5c\u53c2\u6570\uff0c\u6253\u5f00\u5e94\u7528\u5185\u9875\u6216\u7f51\u9875\u65f6\u4f20\u9012\u7ed9\u5e94\u7528\u6216\u7f51\u9875\u3010JSON\u683c\u5f0f\uff0c\u975e\u5fc5\u586b\u3011\uff0c\u5b57\u7b26\u6570\u4e0d\u80fd\u8d85\u8fc74K\uff0c\u793a\u4f8b\uff1a{\"key1\":\"value1\",\"key2\":\"value2\"}\n    notification.setActionParameters(\"{\\\"key1\\\":\\\"value1\\\",\\\"key2\\\":\\\"value2\\\"}\");\n    \/\/ \u5c55\u793a\u7c7b\u578b (0, \u201c\u5373\u65f6\u201d),(1, \u201c\u5b9a\u65f6\u201d)\n    notification.setShowTimeType(1);\n    \/\/ \u5b9a\u65f6\u5c55\u793a\u5f00\u59cb\u65f6\u95f4\uff08\u6839\u636etime_zone\u8f6c\u6362\u6210\u5f53\u5730\u65f6\u95f4\uff09\uff0c\u65f6\u95f4\u7684\u6beb\u79d2\u6570\n    notification.setShowStartTime(System.currentTimeMillis() + 1000 * 60 * 3);\n    \/\/ \u5b9a\u65f6\u5c55\u793a\u7ed3\u675f\u65f6\u95f4\uff08\u6839\u636etime_zone\u8f6c\u6362\u6210\u5f53\u5730\u65f6\u95f4\uff09\uff0c\u65f6\u95f4\u7684\u6beb\u79d2\u6570\n    notification.setShowEndTime(System.currentTimeMillis() + 1000 * 60 * 5);\n    \/\/ \u662f\u5426\u8fdb\u79bb\u7ebf\u6d88\u606f,\u3010\u975e\u5fc5\u586b\uff0c\u9ed8\u8ba4\u4e3aTrue\u3011\n    notification.setOffLine(true);\n    \/\/ \u79bb\u7ebf\u6d88\u606f\u7684\u5b58\u6d3b\u65f6\u95f4(time_to_live) (\u5355\u4f4d\uff1a\u79d2), \u3010off_line\u503c\u4e3atrue\u65f6\uff0c\u5fc5\u586b\uff0c\u6700\u957f3\u5929\u3011\n    notification.setOffLineTtl(24 * 3600);\n    \/\/ \u65f6\u533a\uff0c\u9ed8\u8ba4\u503c\uff1a\uff08GMT+08:00\uff09\u5317\u4eac\uff0c\u9999\u6e2f\uff0c\u65b0\u52a0\u5761\n    notification.setTimeZone(\"GMT+08:00\");\n    \/\/ 0\uff1a\u4e0d\u9650\u8054\u7f51\u65b9\u5f0f, 1\uff1a\u4ec5wifi\u63a8\u9001\n    notification.setNetworkType(0);\n    return notification;\n}\n<\/code><\/pre>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"header-10\"><a><\/a><strong>\u63a8\u9001\u5355\u63a8\u901a\u77e5\u680f\u6d88\u606f<\/strong><\/h4>\n\n\n\n<pre class=\"wp-block-code\"><code>\/\/ \u521b\u5efa\u901a\u77e5\u680f\u6d88\u606f\u4f53\nNotification notification = getNotification(); \n\/\/ \u521b\u5efa\u63a8\u9001\u76ee\u6807\u5bf9\u8c61\uff0c\u4f20\u5165\u6ce8\u518cID\nTarget target = Target.build(\"CN_8fa0618f178145d8c2a44091a1326411\"); \n\/\/ \u8c03\u7528\u5355\u63a8\u63a5\u53e3\uff0c\u63a8\u9001\u6d88\u606f\uff0c\u83b7\u5f97\u8c03\u7528\u7ed3\u679c\nResult result = sender.unicastNotification(notification, target); \n\/\/ \u83b7\u53d6http\u8bf7\u6c42\u72b6\u6001\u7801\nresult.getStatusCode(); \n\/\/ \u83b7\u53d6\u5e73\u53f0\u8fd4\u56de\u7801\nresult.getReturnCode(); \n\/\/ \u83b7\u53d6\u5e73\u53f0\u8fd4\u56de\u7684messageId\nresult.getMessageId();  \n<\/code><\/pre>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"header-11\"><a><\/a><strong>\u63a8\u9001\u6279\u91cf\u5355\u63a8\u901a\u77e5\u680f\u6d88\u606f<\/strong><\/h4>\n\n\n\n<pre class=\"wp-block-code\"><code>\/\/ batch\u6700\u5927\u957f\u5ea6\u4e3a1000\uff0c\u8d85\u51fa\u4f1a\u5bfc\u81f4\u8bf7\u6c42\u5931\u8d25\nMap batch = new HashMap(); \n\/\/ \u521b\u5efa\u76ee\u6807\u5bf9\u8c61\u5e76\u52a0\u5165\u5230\u6279\u91cf\u961f\u5217\u4e2d\nbatch.put(Target.build(\"CN_ddfaa7db1e4ecf75014143bdbc3e53ea\"), getNotification());\nbatch.put(Target.build(\"CN_8fa0618f178145d8c2a44091a1326411\"), getNotification());\n\/\/ \u8c03\u7528\u6279\u91cf\u5355\u63a8\u63a5\u53e3\uff0c\u63a8\u9001\u6d88\u606f\uff0c\u83b7\u5f97\u8c03\u7528\u7ed3\u679c\nResult result = sender.unicastBatchNotification(batch); \n\/\/ \u83b7\u53d6http\u8bf7\u6c42\u72b6\u6001\u7801\nresult.getStatusCode(); \n\/\/ \u83b7\u53d6\u5e73\u53f0\u8fd4\u56de\u7801\nresult.getReturnCode(); \n\/\/ \u83b7\u53d6\u5bf9\u5e94\u6279\u91cf\u5355\u63a8\u7ed3\u679c\nList batchResult = result.getUnicastBatchResults(); \nfor (Result.UnicastBatchResult record : batchResult) {\n    record.getMessageId();\n    record.getErrorCode();\n    record.getErrorMessage();\n    record.getTargetValue();\n}\n<\/code><\/pre>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"header-12\"><a><\/a><strong>\u4fdd\u5b58\u548c\u53d1\u9001\u5e7f\u64ad\u901a\u77e5\u680f\u6d88\u606f<\/strong><\/h4>\n\n\n\n<pre class=\"wp-block-code\"><code>\/**\n * \u63a8\u9001\u5e7f\u64ad\u6d88\u606f\u5206\u4e3a\u4e24\u6b65\n * \u9996\u5148\u8c03\u7528\u4fdd\u5b58\u6d88\u606f\u4f53\u63a5\u53e3\uff0c\u4fdd\u5b58\u5e7f\u64ad\u6d88\u606f\u5185\u5bb9\uff0c\u5f97\u5230\u6d88\u606fID\n * \u4f7f\u7528\u6d88\u606fID\u8c03\u7528\u5e7f\u64ad\u63a8\u9001\u63a5\u53e3\uff0c\u63a8\u9001\u5e7f\u64ad\u6d88\u606f\n * *\/\n\n\/\/ \u521b\u5efa\u901a\u77e5\u680f\u6d88\u606f\u4f53\nNotification broadNotification = getNotification();\n\n\/\/ \u53d1\u9001\u4fdd\u5b58\u6d88\u606f\u4f53\u8bf7\u6c42\nResult saveResult = sender.saveNotification(broadNotification); \n\/\/ \u83b7\u53d6messageId\nString messageId = saveResult.getMessageId(); \n\/\/ \u83b7\u53d6http\u8bf7\u6c42\u72b6\u6001\u7801\nsaveResult.getStatusCode(); \n\/\/ \u83b7\u53d6\u5e73\u53f0\u8fd4\u56de\u7801\nsaveResult.getReturnCode(); \n\n\n\/\/ \u521b\u5efa\u63a8\u9001\u76ee\u6807 \u5e7f\u64ad\u76ee\u6807\u63a5\u53d7\u591a\u4e2a\u6ce8\u518cID\uff0c\u5b57\u7b26\u4e32\u4e2d\u4ee5\u82f1\u6587\u5206\u53f7';'\u5206\u5272\nTarget target = new Target(); \ntarget.setTargetValue(\"CN_ddfaa7db1e4ecf75014143bdbc3e53ea;CN_8fa0618f178145d8c2a44091a1326411\");\n\n\/\/ \u53d1\u9001\u5e7f\u64ad\u6d88\u606f\nResult broadResult = sender.broadcastNotification(messageId, target); \n\/\/ \u83b7\u53d6\u5e7f\u64adtaskId\nbroadResult.getTaskId(); \nList errorList = broadResult.getBroadcastErrorResults();\n\/\/ \u5982\u679c\u5927\u5c0f\u4e3a0\uff0c\u4ee3\u8868\u6240\u6709\u76ee\u6807\u53d1\u9001\u6210\u529f\nif (errorList != null &amp;&amp; errorList.size() &gt; 0) { \n    for (Result.BroadcastErrorResult error : errorList) {\n        \/\/ \u9519\u8bef\u7801\n        error.getErrorCode(); \n        \/\/ \u76ee\u6807\n        error.getTargetValue(); \n    }\n}\n<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"header-13\"><a><\/a><strong>\u4e0a\u4f20\u56fe\u7247<\/strong><\/h3>\n\n\n\n<p>\u5982\u679c\u8981\u63a8\u9001\u5e26\u56fe\u7247\u7684\u6d88\u606f\uff0c\u9700\u8981\u5148\u4e0a\u4f20\u56fe\u7247\u3002<br>\u6ce8\u610f\uff1a\u4ec5<strong>\u5e7f\u64ad\u901a\u77e5\u680f\u6d88\u606f<\/strong>&nbsp;\u652f\u6301\u56fe\u7247\u63a8\u9001\u529f\u80fd\u3002<\/p>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"header-14\"><a><\/a><strong>\u4e0a\u4f20\u5927\u56fe<\/strong><\/h4>\n\n\n\n<pre class=\"wp-block-code\"><code>\/\/ \u6307\u5b9a\u56fe\u7247\u6587\u4ef6\nFile bigPicture = new File(\"\u5927\u56fe\u6587\u4ef6\u8def\u5f84\");\n\/\/ \u56fe\u7247\u8fc7\u671f\u65f6\u95f4\uff08\u5355\u4f4d\u79d2\uff09\uff0c\u6700\u957f30\u5929 \nint bigPictureTtl = 86400; \n\/\/ \u4f7f\u7528Sender\u8c03\u7528\u4e0a\u4f20\u5927\u56fe\u63a5\u53e3 \nResult uploadBigPicResult = sender.uploadBigPicture(bigPictureTtl, bigPicture); \n\/\/ \u83b7\u53d6\u5927\u56feid,\u4fdd\u5b58\u6d88\u606f\u4f53\u586b\u5165\nString bigPictureId = uploadBigPicResult.getBigPictureId(); \n\n\/\/ \u521b\u5efa\u6d88\u606f\u4f53\u65f6\u9009\u62e9\u56fe\u7247\u63a8\u9001\u6d88\u606f\u7c7b\u578b(3\u8868\u793a\u56fe\u7247\u63a8\u9001)\uff0c\u5e76\u4f20\u5165\u56fe\u7247ID\nNotification notification = getNotification();\nnotification.setStyle(3);\nnotification.setBigPictureId(bigPictureId);\n\n\/\/ \u6267\u884c\u4fdd\u5b58\u6d88\u606f\u4f53\uff0c\u5e7f\u64ad\u63a8\u9001\u7b49\u540e\u7eed\u64cd\u4f5c\n\/\/ save and send notification ...\n<\/code><\/pre>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"header-15\"><a><\/a><strong>\u4e0a\u4f20\u56fe\u6807<\/strong><\/h4>\n\n\n\n<pre class=\"wp-block-code\"><code>\/\/ \u6307\u5b9a\u56fe\u7247\u6587\u4ef6\nFile smallPicture = new File(\"\u5c0f\u56fe\u6587\u4ef6\u8def\u5f84\");\n\/\/ \u56fe\u7247\u8fc7\u671f\u65f6\u95f4\uff08\u5355\u4f4d\u79d2\uff09\uff0c\u6700\u957f30\u5929\nint smallPictureTtl = 86400;  \n\/\/ \u4f7f\u7528Sender\u5bf9\u8c61\u8c03\u7528\u4e0a\u4f20\u5c0f\u56fe\u63a5\u53e3\nResult uploadSmallPicResult = sender.uploadSmallPicture(smallPictureTtl, smallPicture);\n\/\/ \u83b7\u53d6\u5c0f\u56feid\uff0c\u4fdd\u5b58\u6d88\u606f\u4f53\nString smallPictureId = uploadSmallPicResult.getSmallPictureId(); \n\n\/\/ \u521b\u5efa\u6d88\u606f\u4f53\u65f6\u9009\u62e9\u56fe\u7247\u63a8\u9001\u6d88\u606f\u7c7b\u578b(3\u8868\u793a\u56fe\u7247\u63a8\u9001)\uff0c\u5e76\u4f20\u5165\u56fe\u7247ID\nNotification notification = getNotification();\nnotification.setStyle(3);\nnotification.set(smallPictureId);\n\n\/\/ \u6267\u884c\u4fdd\u5b58\u6d88\u606f\u4f53\uff0c\u5e7f\u64ad\u63a8\u9001\u7b49\u540e\u7eed\u64cd\u4f5c\n\/\/ save and send notification ...<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>SDK\u63d0\u4f9bSender\u7c7b\u5c01\u88c5\u4e86OPPO Push\u63a8\u9001\u670d\u52a1\u7684\u5404\u7c7b\u670d\u52a1\u63a5\u53e3\u3002\u56e0\u6b64\uff0c\u4f7f\u7528SDK\u63a8\u9001\u6d88\u606f\u6216\u8c03\u7528\u5176\u4ed6\u670d\u52a1\uff0c\u9996\u5148\u8981\u521b\u5efaSender\u5bf9\u8c61\u3002<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[46],"tags":[5166,5163,5201,5200,5199,5203,5202,5204],"special":[65],"attr":[],"class_list":{"0":"post-11074","1":"post","2":"type-post","3":"status-publish","4":"format-standard","5":"hentry","6":"category-appsj","7":"tag-oppo-push","8":"tag-oppo","11":"tag-sender","12":"tag-5203","13":"tag-5202","14":"tag-5204","15":"special-oppokfpt","16":"entry"},"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/www.yimenapp.com\/kb-yimen\/wp-json\/wp\/v2\/posts\/11074","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=11074"}],"version-history":[{"count":1,"href":"https:\/\/www.yimenapp.com\/kb-yimen\/wp-json\/wp\/v2\/posts\/11074\/revisions"}],"predecessor-version":[{"id":11075,"href":"https:\/\/www.yimenapp.com\/kb-yimen\/wp-json\/wp\/v2\/posts\/11074\/revisions\/11075"}],"wp:attachment":[{"href":"https:\/\/www.yimenapp.com\/kb-yimen\/wp-json\/wp\/v2\/media?parent=11074"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.yimenapp.com\/kb-yimen\/wp-json\/wp\/v2\/categories?post=11074"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.yimenapp.com\/kb-yimen\/wp-json\/wp\/v2\/tags?post=11074"},{"taxonomy":"special","embeddable":true,"href":"https:\/\/www.yimenapp.com\/kb-yimen\/wp-json\/wp\/v2\/special?post=11074"},{"taxonomy":"attr","embeddable":true,"href":"https:\/\/www.yimenapp.com\/kb-yimen\/wp-json\/wp\/v2\/attr?post=11074"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}