{"id":15839,"date":"2022-12-22T15:15:46","date_gmt":"2022-12-22T07:15:46","guid":{"rendered":"https:\/\/www.yimenapp.com\/kb-yimen\/?p=15839"},"modified":"2022-12-22T15:15:47","modified_gmt":"2022-12-22T07:15:47","slug":"%e6%9e%81%e5%85%89%e6%b6%88%e6%81%af%e6%8e%a8%e9%80%81android-%e9%80%9a%e7%9f%a5%e7%82%b9%e5%87%bb%e8%b7%b3%e8%bd%ac%e6%95%99%e7%a8%8b","status":"publish","type":"post","link":"https:\/\/www.yimenapp.com\/kb-yimen\/15839\/","title":{"rendered":"\u6781\u5149\u6d88\u606f\u63a8\u9001Android \u901a\u77e5\u70b9\u51fb\u8df3\u8f6c\u6559\u7a0b"},"content":{"rendered":"\n<p>\u672c\u6587\u65e8\u8981\u4ecb\u7ecd\u6709\u76ee\u6807\u5730\u5740\u65f6\u5982\u4f55\u4f7f\u7528 intent\u3001deeplink \u548c\u76f4\u63a5\u6253\u5f00\u5e94\u7528\u7684\u65b9\u5f0f\u5b9e\u73b0\u70b9\u51fb\u901a\u77e5\u8df3\u8f6c\u5230\u76ee\u6807\u9875\u9762\u3002<span class=\"wpcom_tag_link\"><a href=\"https:\/\/www.yimenapp.com\/kb-yimen\/tag\/%e6%9e%81%e5%85%89\/\" title=\"\u6781\u5149\" target=\"_blank\">\u6781\u5149<\/a><\/span>\u5f3a\u70c8\u5efa\u8bae\u4f60\u5347\u7ea7 SDK \u81f3 4.6.0 \u53ca\u4ee5\u4e0a\u7248\u672c\uff0c\u5e76\u914d\u7f6e\u901a\u77e5\u8df3\u8f6c\u76ee\u6807\u5730\u5740\u6765\u5b9e\u73b0\u70b9\u51fb\u901a\u77e5\u8df3\u8f6c\u529f\u80fd\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"\u652f\u6301\u7248\u672c\">\u652f\u6301\u7248\u672c<\/h2>\n\n\n\n<p>Rest API \u7684 intent \u5b57\u6bb5\u5305\u62ec intent\u3001deeplink \u548c\u76f4\u63a5\u6253\u5f00\u5e94\u7528\u7684\u8df3\u8f6c\u65b9\u5f0f\u3002<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>SDK\uff1c4.2.2 \u7684\u7248\u672c\uff0cintent \u5b57\u6bb5\u503c\u4ec5\u8d70\u534e\u7855\u901a\u9053\u548c\u6781\u5149\u901a\u9053\u65f6\u751f\u6548\uff0c\u4e0d\u5f71\u54cd\u8bf7\u6c42\u8d70\u5176\u5b83\u5382\u5546\u901a\u9053\u3002<\/li><li>SDK \u2265 4.2.2 \u7684\u7248\u672c\uff0cAPI \u63a8\u9001\u65f6\u5efa\u8bae\u586b\u5199 intent \u5b57\u6bb5\uff0c\u5426\u5219\u70b9\u51fb\u901a\u77e5\u53ef\u80fd\u65e0\u8df3\u8f6c\u52a8\u4f5c\u3002<\/li><\/ul>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"\u914d\u7f6e\u76ee\u6807\u5730\u5740\u8bf4\u660e\">\u914d\u7f6e\u76ee\u6807\u5730\u5740\u8bf4\u660e<\/h2>\n\n\n\n<p>\u914d\u7f6e\u901a\u77e5\u8df3\u8f6c\u76ee\u6807\u5730\u5740\u6307\u63a8\u9001\u4e0b\u53d1\u65f6\u6709\u5728\u63a7\u5236\u53f0\u6216\u8005 API \u4e2d\u5b8c\u6210\u4ee5\u4e0b\u914d\u7f6e\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"\u63a7\u5236\u53f0\u914d\u7f6e\">\u63a7\u5236\u53f0\u914d\u7f6e<\/h3>\n\n\n\n<p>\u63a7\u5236\u53f0\u4e0b\u53d1\u65f6\u914d\u7f6e \u201cAndroid \u70b9\u51fb\u901a\u77e5\u6253\u5f00\u201d\u4e2d\u4efb\u610f\u4e00\u4e2a\u9009\u9879\u3002\u00a0<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" width=\"2090\" height=\"546\" src=\"https:\/\/kb.cdn.yimenapp.com\/yimen\/2022\/12\/20221222151517384.png\" alt=\"\" class=\"wp-image-15844\"\/><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"api-\u4f7f\u7528\">API \u4f7f\u7528<\/h3>\n\n\n\n<p>API \u63a8\u9001\u65f6\u5728 notification.android \u4e0b\u53d1 intent \u6216\u8005 uri_activity\u3001uri_action \u5b57\u6bb5\u3002<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>SDK \u2265 4.2.2 \u7684\u7248\u672c\uff0c\u53ea\u9700\u8981\u586b\u5199 intent \u53c2\u6570\u3002<\/li><li>SDK\uff1c4.2.2 \u7684\u7248\u672c\uff0c\u4e14\u914d\u7f6e\u8fc7 uri_activity \u548c uri_action \u8df3\u8f6c\u7684\uff0c\u53ea\u9700\u8981\u586b\u5199 uri_activity \u548c uri_action\u3002<\/li><\/ul>\n\n\n\n<figure class=\"wp-block-table\"><table><thead><tr><th>\u5173\u952e\u5b57<\/th><th>\u7c7b\u578b<\/th><th>\u9009\u9879<\/th><th>\u542b\u4e49<\/th><th>\u8bf4\u660e<\/th><\/tr><\/thead><tbody><tr><td>intent<\/td><td>JSON Object<\/td><td>\u53ef\u9009<\/td><td>\u6307\u5b9a\u8df3\u8f6c\u9875\u9762<\/td><td>\u4f7f\u7528 intent \u91cc\u7684 url \u6307\u5b9a\u70b9\u51fb\u901a\u77e5\u680f\u540e\u8df3\u8f6c\u7684\u76ee\u6807\u9875\u9762;SDK\uff1c4.2.2\u7684\u7248\u672c\uff0c\u6b64\u5b57\u6bb5\u503c\u4ec5\u5bf9\u8d70\u534e\u7855\u901a\u9053\u548c\u6781\u5149\u81ea\u6709\u901a\u9053\u4e0b\u53d1\u751f\u6548\uff0c\u4e0d\u5f71\u54cd\u8bf7\u6c42\u8d70\u5176\u5b83\u5382\u5546\u901a\u9053\u3002SDK\u22654.2.2\u7684\u7248\u672c\uff0cAPI \u63a8\u9001\u65f6\u5efa\u8bae\u586b\u5199 intent \u5b57\u6bb5\uff0c\u5426\u5219\u70b9\u51fb\u901a\u77e5\u53ef\u80fd\u65e0\u8df3\u8f6c\u52a8\u4f5c\u3002\u6b64\u5b57\u6bb5\u652f\u6301\u4ee5\u4e0b\u4e09\u79cd\u7c7b\u578b:<br>1. \u8df3\u8f6c\u5230\u76ee\u6807\u9875:<br>intent:#Intent;action=action \u8def\u5f84;component=\u5305\u540d\/Activity \u5168\u540d;end<br>\uff08OPPO \u548c FCM \u901a\u9053\u5fc5\u987b\u4f20&#8221;action \u8def\u5f84&#8221;, \u5176\u4ed6\u5382\u5546\u5fc5\u987b\u4f20&#8221;Activity \u5168\u540d&#8221;, \u5426\u5219\u5c06\u51fa\u73b0\u5bf9\u5e94\u5382\u5546\u65e0\u6cd5\u8df3\u8f6c\u95ee\u9898\uff09<br>2. \u8df3\u8f6c\u5230 deeplink \u5730\u5740:<br>scheme:\/\/test?key1=val1&amp;key2=val2<br>3. \u5e94\u7528\u9996\u9875: intent:#Intent;action=android.intent.action.MAIN;end (\u56fa\u5b9a\u4e3a\u6b64\u5730\u5740)<\/td><\/tr><tr><td>uri_activity<\/td><td>string<\/td><td>\u53ef\u9009<\/td><td>\u6307\u5b9a\u8df3\u8f6c\u9875\u9762<\/td><td>\u8be5\u5b57\u6bb5\u7528\u4e8e\u6307\u5b9a\u5f00\u53d1\u8005\u60f3\u8981\u6253\u5f00\u7684 activity\uff0c\u503c\u4e3a activity \u8282\u70b9\u7684 \u201candroid:name\u201d\u5c5e\u6027\u503c\u3002\u9002\u914d\u534e\u4e3a\u3001\u5c0f\u7c73\u3001vivo \u5382\u5546\u901a\u9053\u8df3\u8f6c\u3002Jpush SDK\u2265V4.2.2\uff0c\u53ef\u4e0d\u518d\u586b\u5199\u672c\u5b57\u6bb5\uff0c\u4ec5\u8bbe\u7f6e intent \u5b57\u6bb5\u5373\u53ef\u3002<\/td><\/tr><tr><td>uri_action<\/td><td>string<\/td><td>\u53ef\u9009<\/td><td>\u6307\u5b9a\u8df3\u8f6c\u9875\u9762<\/td><td>\u8be5\u5b57\u6bb5\u7528\u4e8e\u6307\u5b9a\u5f00\u53d1\u8005\u60f3\u8981\u6253\u5f00\u7684 activity\uff0c\u503c\u4e3a &#8220;activity&#8221;-&#8220;intent-filter&#8221;-&#8220;action&#8221; \u8282\u70b9\u7684 &#8220;android:name&#8221; \u5c5e\u6027\u503c\u3002\u9002\u914d oppo\u3001fcm\u8df3\u8f6c\u3002Jpush SDK\u2265V4.2.2\uff0c\u53ef\u4e0d\u518d\u586b\u5199\u672c\u5b57\u6bb5\uff0c\u4ec5\u8bbe\u7f6e intent \u5b57\u6bb5\u5373\u53ef\uff0c\u4f46\u82e5\u9700\u517c\u5bb9\u65e7\u7248 SDK \u5fc5\u987b\u586b\u5199\u8be5\u5b57\u6bb5\u3002<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"intent-\u65b9\u5f0f\uff08\u63a8\u8350\uff09\">intent \u65b9\u5f0f\uff08\u63a8\u8350\uff09<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"\u683c\u5f0f\u8bf4\u660e\">\u683c\u5f0f\u8bf4\u660e<\/h3>\n\n\n\n<p>\u56fa\u5b9a\u683c\u5f0f \uff1aintent:#Intent;action=&#8221;action \u8def\u5f84&#8221;;component=&#8221;\u5305\u540d&#8221;\/&#8221;Activity \u7ec4\u4ef6\u8def\u5f84&#8221;;end<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>intenturi \u5fc5\u987b\u4ee5 &#8220;intent:#Intent;&#8221; \u5f00\u5934\uff0c\u4ee5 &#8220;;end&#8221; \u7ed3\u5c3e\u3002<\/li><li>\u4e0d\u5141\u8bb8\u5b58\u5728\u591a\u4e2a &#8220;action=&#8221; \u5b57\u7b26\u6216 &#8220;component=&#8221; \u5b57\u7b26\u3002<\/li><\/ul>\n\n\n\n<p>\u793a\u4f8b\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">          <code>intent:#Intent;action=cn.jiguang.myaction;component=cn.jiguang.jumptest\/cn.jiguang.jumptest.OpenClickActivity;<strong>end<\/strong>\n<\/code>\n        <\/pre>\n\n\n\n<p>\u643a\u5e26\u53c2\u6570\u683c\u5f0f\uff1aintent:#Intent;action=\u201caction \u8def\u5f84\u201d;component=&#8221;\u5305\u540d&#8221;\/&#8221;Activity \u7ec4\u4ef6\u8def\u5f84&#8221;;S.key1=value1;i.key2=2;end<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>&#8220;S.&#8221;\uff1a\u4ee3\u8868\u53c2\u6570\u503c\u662f String \u683c\u5f0f\u3002<\/li><li>&#8220;i.&#8221;\uff1a\u4ee3\u8868\u53c2\u6570\u503c\u662f Int \u683c\u5f0f\u3002<\/li><\/ul>\n\n\n\n<p>\u793a\u4f8b\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">          <code>intent:#Intent;action=cn.jiguang.myaction;component=cn.jiguang.jumptest\/cn.jiguang.jumptest.OpenClickActivity;S.key1=value;i.key2=2;<strong>end<\/strong>\n<\/code>\n        <\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"\u5ba2\u6237\u7aef\u914d\u7f6e\">\u5ba2\u6237\u7aef\u914d\u7f6e<\/h3>\n\n\n\n<p>\u5728 AndroidManifest \u4e2d\u5b8c\u6210\u4ee5\u4e0b\u914d\u7f6e\u3002<\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\"><p>OPPO \u901a\u9053\u548c FCM \u901a\u9053\u5fc5\u987b\u914d\u7f6e action \u548c category \u624d\u53ef\u4ee5\u8df3\u8f6c\u3002<\/p><\/blockquote>\n\n\n\n<pre class=\"wp-block-preformatted\">          <code>&lt;activity\n    android:name=\"cn.jiguang.jumptest.OpenClickActivity\"\n    android:exported=\"true\"\n    android:launchMode=\"singleTask\"\n    android:screenOrientation=\"portrait\"&gt;\n    &lt;intent-filter&gt;\n        &lt;action android:name=\"cn.jiguang.myaction\" &gt;&lt;\/action&gt;\n        &lt;category android:name=\"android.intent.category.DEFAULT\" \/&gt;\n    &lt;\/intent-filter&gt;\n&lt;\/activity&gt;\n<\/code>\n        <\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"\u670d\u52a1\u7aef\u4f7f\u7528\">\u670d\u52a1\u7aef\u4f7f\u7528<\/h3>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"\u63a7\u5236\u53f0\u4f7f\u7528\">\u63a7\u5236\u53f0\u4f7f\u7528<\/h4>\n\n\n\n<p>\u8fdb\u5165\u3010\u6d88\u606f\u63a8\u9001\u3011-\u3010\u63a8\u9001\u7ba1\u7406\u3011-\u3010\u521b\u5efa\u63a8\u9001\u3011\u9875\u9762\uff0c\u9009\u62e9 Android \u5e73\u53f0\uff0c \u5e76\u5728 \u201cAndroid \u70b9\u51fb\u901a\u77e5\u6253\u5f00\u201d\u4e2d\u9009\u62e9\u201cintent\uff08\u63a8\u8350\uff09\u201d\uff0c\u586b\u5199 intent \u3002<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" width=\"2024\" height=\"470\" src=\"https:\/\/kb.cdn.yimenapp.com\/yimen\/2022\/12\/20221222151510255.png\" alt=\"\" class=\"wp-image-15843\"\/><\/figure>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"api-\u4f7f\u7528-1\">API \u4f7f\u7528<\/h4>\n\n\n\n<ul class=\"wp-block-list\"><li>SDK \u2265 4.2.2 \u7684\u7248\u672c\uff0c\u53ea\u9700\u8981\u586b\u5199 intent \u53c2\u6570\uff0c\u53c2\u6570\u8be6\u60c5\u53c2\u8003&nbsp;<a href=\"https:\/\/docs.jiguang.cn\/jpush\/practice\/intent#api-%E4%BD%BF%E7%94%A8\">API \u4f7f\u7528<\/a>\u3002<\/li><li>SDK\uff1c4.2.2 \u7684\u7248\u672c\uff0c\u4e14\u914d\u7f6e\u8fc7 uri_activity \u548c uri_action \u8df3\u8f6c\u7684\uff0c\u53ea\u9700\u8981\u586b\u5199 uri_activity \u548c uri_action\u3002<\/li><\/ul>\n\n\n\n<pre class=\"wp-block-preformatted\">          <code>{\n    \"notification\" : {\n        \"android\" : {\n             \"alert\" : \"hello, JPush!\", \n             \"title\" : \"JPush test\", \n             \"intent\": {\n                \"url\": \"intent:#Intent;action=cn.jiguang.myaction;component=cn.jiguang.jumptest\/cn.jiguang.jumptest.OpenClickActivity;S.key1=value;i.key2=3;end\"\n            },\n            \"uri_activity\": \"cn.jiguang.jumptest.OpenClickActivity\",\/\/\u517c\u5bb94.2.2\u4ee5\u4e0b\u7248\u672c\n            \"uri_action\": \"cn.jiguang.jumptest.OpenClickActivity\"\/\/\u517c\u5bb94.2.2\u4ee5\u4e0b\u7248\u672c\n            \n        }\n    }\n}\n<\/code>\n        <\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"\u5ba2\u6237\u7aef\u83b7\u53d6\u53c2\u6570\">\u5ba2\u6237\u7aef\u83b7\u53d6\u53c2\u6570<\/h3>\n\n\n\n<p>\u82e5\u9700\u8981\u8df3\u8f6c\u81f3\u9875\u9762\u6307\u5b9a\u4f4d\u7f6e\uff0c\u63a8\u9001\u65f6\u53ef\u4ee5\u4e0b\u53d1\u81ea\u5b9a\u4e49\u53c2\u6570\uff0c\u83b7\u53d6\u53c2\u6570\u540e\u81ea\u884c\u5904\u7406\u4e1a\u52a1\u8df3\u8f6c\u903b\u8f91\u3002<\/p>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"\u83b7\u53d6-intent-\u643a\u5e26\u53c2\u6570\">\u83b7\u53d6 intent \u643a\u5e26\u53c2\u6570<\/h4>\n\n\n\n<p>SDK \u9488\u5bf9 intent \u914d\u7f6e\u7684\u53c2\u6570\u5747\u662f\u900f\u4f20\u7684\uff0c\u6240\u4ee5\u5728\u76ee\u6807 Activity \u76f4\u63a5\u83b7\u53d6 intent \u8df3\u8f6c\u83b7\u53d6\u53c2\u6570\u5373\u53ef\u3002<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">          <code>package cn.jiguang.jumptest;\n<strong>import<\/strong> androidx.appcompat.app.AppCompatActivity;\n<strong>import<\/strong> android.content.Intent;\n<strong>import<\/strong> android.os.Bundle;\n<strong>import<\/strong> android.util.Log;\n\n<strong>public<\/strong> <strong>class<\/strong> MainActivity <strong>extends<\/strong> AppCompatActivity {\n \n    @Override\n    <strong>protected<\/strong> void onCreate(<strong>Bundle savedInstanceState<\/strong>) {\n        super.onCreate(savedInstanceState);\n        setContentView(R.layout.activity_main);\n        handleIntent();\n    }\n \n    @Override\n    <strong>protected<\/strong> void onNewIntent(<strong>Intent intent<\/strong>) {\n        super.onNewIntent(intent);\n        handleIntent();\n    }\n    void handleIntent(<strong><\/strong>){\n        <strong>if<\/strong>(getIntent()!=null){\n            String value1 =getIntent().getStringExtra(\"key1\");\n            int value2 =getIntent().getIntExtra(\"key2\",0);\n            Log.e(\"MainActivity\",\"\"+value1);\n            Log.e(\"MainActivity\",\"\"+value2);\n        }\n    }\n}\n<\/code>\n        <\/pre>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"\u83b7\u53d6-extras-\u9644\u52a0\u53c2\u6570\">\u83b7\u53d6 Extras \u9644\u52a0\u53c2\u6570<\/h4>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" width=\"2354\" height=\"668\" src=\"https:\/\/kb.cdn.yimenapp.com\/yimen\/2022\/12\/20221222151504224.png\" alt=\"\" class=\"wp-image-15842\"\/><\/figure>\n\n\n\n<ul class=\"wp-block-list\"><li>SDK \uff1c 4.6.0 \u7248\u672c\u65f6\uff0c\u6781\u5149\u901a\u9053\u6709 onNotifyMessageOpened \u70b9\u51fb\u56de\u8c03\uff0c\u5382\u5546\u901a\u9053\u6ca1\u6709 onNotifyMessageOpened \u70b9\u51fb\u56de\u8c03\u3002<\/li><li>SDK \u2265 4.6.0 \u7248\u672c\u65f6\uff0cAndroid \u6781\u5149\u901a\u9053\u548c\u5382\u5546\u901a\u9053\u7edf\u4e00\u5904\u7406\uff1a\u65e0\u901a\u77e5\u8df3\u8f6c\u76ee\u6807\u5730\u5740\u6709 onNotifyMessageOpened \u70b9\u51fb\u56de\u8c03\uff0c\u6709\u901a\u77e5\u8df3\u8f6c\u76ee\u6807\u5730\u5740\u65f6\u6ca1\u6709 onNotifyMessageOpened \u70b9\u51fb\u56de\u8c03\u3002<\/li><\/ul>\n\n\n\n<p>1.\u6709\u914d\u7f6e\u901a\u77e5\u8df3\u8f6c\u76ee\u6807\u5730\u5740\u65f6\uff1a<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>SDK\uff1c4.6.0 \u7248\u672c<ul><li>\u534e\u4e3a\u901a\u9053\u4f7f\u7528<code>getIntent().getData().toString()<\/code>\u65b9\u6cd5\u83b7\u53d6\u53c2\u6570\u3002<\/li><li>\u5c0f\u7c73\u3001vivo\u3001OPPO\u3001FCM\u3001\u9b45\u65cf\u901a\u9053\u4f7f\u7528&nbsp;<code>getIntent().getExtras().getString(\u201cJMessageExtra\u201d)<\/code>&nbsp;\u65b9\u6cd5\u83b7\u53d6\u53c2\u6570\u3002<\/li><li>\u6781\u5149\u901a\u9053\u5728\u56de\u8c03\u7684\u51fd\u6570&nbsp;<code>onNotifyMessageOpened(Context context, NotificationMessage message)<\/code>&nbsp;\u4e2d\u7684 message \u4e2d\u83b7\u53d6\u53c2\u6570\u3002<\/li><\/ul><\/li><li>SDK \u2265 4.6.0 \u7248\u672c<ul><li>\u534e\u4e3a\u901a\u9053\u4f7f\u7528<code>getIntent().getData().toString()<\/code>\u65b9\u6cd5\u83b7\u53d6\u53c2\u6570\u3002<\/li><li>\u5c0f\u7c73\u3001vivo\u3001OPPO\u3001FCM\u3001\u9b45\u65cf\u3001\u8363\u8000\u3001\u6781\u5149\u901a\u9053\u4f7f\u7528&nbsp;<code>getIntent().getExtras().getString(\u201cJMessageExtra\u201d)<\/code>&nbsp;\u65b9\u6cd5\u83b7\u53d6\u53c2\u6570\u3002<\/li><\/ul><\/li><\/ul>\n\n\n\n<p>2.\u65e0\u914d\u7f6e\u901a\u77e5\u8df3\u8f6c\u76ee\u6807\u5730\u5740\u65f6\uff1a<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>SDK\uff1c4.6.0 \u7248\u672c\u65f6\uff1a<ul><li>\u5382\u5546\u901a\u9053\u6ca1\u6709\u70b9\u51fb\u56de\u8c03\uff0c\u70b9\u51fb\u65e0\u6cd5\u8df3\u8f6c\uff0c\u65e0\u6cd5\u83b7\u53d6\u53c2\u6570\u3002<\/li><li>\u6781\u5149\u901a\u9053\u5728\u56de\u8c03\u7684\u51fd\u6570&nbsp;<code>onNotifyMessageOpened(Context context, NotificationMessage message)<\/code>&nbsp;\u4e2d\u7684 message \u4e2d\u83b7\u53d6\u53c2\u6570\u3002<\/li><\/ul><\/li><li>SDK \u2265 4.6.0 \u7248\u672c\u65f6\uff0c\u6240\u6709\u901a\u9053\u5728\u56de\u8c03\u7684\u51fd\u6570&nbsp;<code>onNotifyMessageOpened(Context context, NotificationMessage message)<\/code>&nbsp;\u4e2d\u7684 message \u4e2d\u83b7\u53d6\u53c2\u6570\u3002<\/li><\/ul>\n\n\n\n<p><strong>\u793a\u4f8b\u5982\u4e0b<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">          <code>package com.HuananThirdPush.cn;\n\n<strong>import<\/strong> android.app.Activity;\n<strong>import<\/strong> android.os.Bundle;\n<strong>import<\/strong> android.text.TextUtils;\n<strong>import<\/strong> android.util.Log;\n<strong>import<\/strong> android.widget.TextView;\n<strong>import<\/strong> org.json.JSONException;\n<strong>import<\/strong> org.json.JSONObject;\n<strong>import<\/strong> cn.jpush.android.api.JPushInterface;\n\n<strong>public<\/strong> <strong>class<\/strong> OpenClickActivity <strong>extends<\/strong> Activity {\n    <strong>private<\/strong> <strong>static<\/strong> final String TAG = \"OpenClickActivity\";\n    \/**\u901a\u77e5\u9644\u52a0\u5b57\u6bb5**\/\n    <strong>private<\/strong> <strong>static<\/strong> final String KEY_EXTRAS = \"n_extras\";\n    <strong>private<\/strong> TextView mTextView;\n\n    @Override\n    <strong>protected<\/strong> void onCreate(<strong>Bundle savedInstanceState<\/strong>) {\n        super.onCreate(savedInstanceState);\n        mTextView = <strong>new<\/strong> TextView(this);\n        setContentView(mTextView);\n        handleOpenClick();\n    }\n\n    \/**\n     * \u5904\u7406\u70b9\u51fb\u4e8b\u4ef6\uff0c\u5f53\u524d\u542f\u52a8\u914d\u7f6e\u7684Activity\u90fd\u662f\u4f7f\u7528\n     * Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TASK\n     * \u65b9\u5f0f\u542f\u52a8\uff0c\u53ea\u9700\u8981\u5728onCreat\u4e2d\u8c03\u7528\u6b64\u65b9\u6cd5\u8fdb\u884c\u5904\u7406\n     *\/\n    <strong>private<\/strong> void handleOpenClick(<strong><\/strong>) {\n        Log.d(TAG, \"\u7528\u6237\u70b9\u51fb\u6253\u5f00\u4e86\u901a\u77e5\");\n        String data = null;\n        \n        \/\/\u83b7\u53d6\u534e\u4e3a\u5e73\u53f0\u9644\u5e26\u7684jpush\u4fe1\u606f\n        <strong>if<\/strong> (getIntent().getData() != null) {\n            data = getIntent().getData().toString();\n        }\n\n        \/\/\u83b7\u53d6fcm\/oppo\/\u5c0f\u7c73\/vivo\/\u9b45\u65cf\/\u8363\u8000 \u5e73\u53f0\u9644\u5e26\u7684jpush\u4fe1\u606f\n        <strong>if<\/strong> (TextUtils.isEmpty(data) &amp;&amp; getIntent().getExtras() != null) {\n            data = getIntent().getExtras().getString(\"JMessageExtra\");\n        }\n\n        Log.w(TAG, \"msg content is \" + String.valueOf(data));\n        <strong>if<\/strong> (TextUtils.isEmpty(data)) <strong>return<\/strong>;\n        <strong>try<\/strong> {\n            JSONObject jsonObject = <strong>new<\/strong> JSONObject(data);\n            String extras = jsonObject.optString(KEY_EXTRAS);\n            StringBuilder sb = <strong>new<\/strong> StringBuilder();\n            sb.append(\"extras:\");\n            sb.append(String.valueOf(extras));\n            sb.append(\"\\n\");\n            mTextView.setText(sb.toString());\n\n    }\n}\n<\/code>\n        <\/pre>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"deeplink-\u65b9\u5f0f\">deeplink \u65b9\u5f0f<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"\u683c\u5f0f\u8bf4\u660e-1\">\u683c\u5f0f\u8bf4\u660e<\/h3>\n\n\n\n<p><strong>\u56fa\u5b9a\u683c\u5f0f\uff1a<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>scheme:\/\/<\/li><li>scheme:\/\/host<\/li><li>scheme:\/\/host\/path<\/li><\/ul>\n\n\n\n<p><strong>\u643a\u5e26\u53c2\u6570\u683c\u5f0f\uff1a<\/strong><br>scheme:\/\/host\/path?key1=val1&amp;key2=val2<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"\u5ba2\u6237\u7aef\u914d\u7f6e-1\">\u5ba2\u6237\u7aef\u914d\u7f6e<\/h3>\n\n\n\n<p>\u5728 AndroidManifest \u4e2d\u5b8c\u6210\u4ee5\u4e0b\u914d\u7f6e\u3002<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>action\u3001category \u5fc5\u987b\u6309\u7167\u4e0b\u5217\u793a\u4f8b\u914d\u7f6e\u3002<\/li><li>data \u7684 scheme \u5fc5\u987b\u914d\u7f6e\uff0c\u5176\u4ed6\u53c2\u6570\u53ef\u9009\u3002<\/li><\/ul>\n\n\n\n<pre class=\"wp-block-preformatted\">          <code>\n&lt;activity android:name=\".DeeplinkTestActivity\"&gt;\n    &lt;intent-filter&gt;\n        &lt;action android:name=\"android.intent.action.VIEW\" \/&gt;\n        &lt;category android:name=\"android.intent.category.DEFAULT\" \/&gt;\n        &lt;category android:name=\"android.intent.category.BROWSABLE\" \/&gt;\n        &lt;data\n            android:scheme=\"jiguang\"\n            android:host=\"deeptest\"\n            android:path=\"\/index\"\/&gt;\n    &lt;\/intent-filter&gt;\n&lt;\/activity&gt;\n<\/code>\n        <\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"\u670d\u52a1\u7aef\u4f7f\u7528-1\">\u670d\u52a1\u7aef\u4f7f\u7528<\/h3>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"\u63a7\u5236\u53f0\u4f7f\u7528-1\">\u63a7\u5236\u53f0\u4f7f\u7528<\/h4>\n\n\n\n<p>\u8fdb\u5165\u3010\u6d88\u606f\u63a8\u9001\u3011-\u3010\u63a8\u9001\u7ba1\u7406\u3011-\u3010\u521b\u5efa\u63a8\u9001\u3011\u9875\u9762\uff0c\u9009\u62e9 Android \u5e73\u53f0\uff0c \u5e76\u5728 \u201cAndroid \u70b9\u51fb\u901a\u77e5\u6253\u5f00\u201d\u4e2d\u9009\u62e9\u201cDeepLink\u201d\uff0c\u586b\u5199 DeepLink\u3002\u00a0<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" width=\"1904\" height=\"420\" src=\"https:\/\/kb.cdn.yimenapp.com\/yimen\/2022\/12\/20221222151457767.png\" alt=\"\" class=\"wp-image-15841\"\/><\/figure>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"api-\u4f7f\u7528-2\">API \u4f7f\u7528<\/h4>\n\n\n\n<ul class=\"wp-block-list\"><li>SDK \u2265 4.2.2 \u7684\u7248\u672c\uff0c\u53ea\u9700\u8981\u586b\u5199 intent \u53c2\u6570\uff0c\u53c2\u6570\u8be6\u60c5\u53c2\u8003&nbsp;<a href=\"https:\/\/docs.jiguang.cn\/jpush\/practice\/intent#api-%E4%BD%BF%E7%94%A8\">API \u4f7f\u7528<\/a>\u3002<\/li><li>SDK\uff1c4.2.2 \u7684\u7248\u672c\uff0c\u4e14\u914d\u7f6e\u8fc7 uri_activity \u548c uri_action \u8df3\u8f6c\u7684\uff0c\u53ea\u9700\u8981\u586b\u5199 uri_activity \u548c uri_action\u3002<\/li><\/ul>\n\n\n\n<pre class=\"wp-block-preformatted\">          <code>{\n    \"notification\" : {\n        \"android\" : {\n             \"alert\" : \"hello, JPush!\", \n             \"title\" : \"JPush test\", \n             \"intent\": {\n                \"url\": \"jiguang:\/\/deeptest\/index?key1=val1&amp;key2=val2\"\n            },\n            \"uri_activity\": \"cn.jiguang.jumptest.DeeplinkTestActivity\",\/\/\u517c\u5bb94.2.2\u4ee5\u4e0b\u7248\u672c\n            \"uri_action\": \"cn.jiguang.jumptest.DeeplinkTestActivity\"\/\/\u517c\u5bb94.2.2\u4ee5\u4e0b\u7248\u672c\n            \n        }\n    }\n}\n<\/code>\n        <\/pre>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"\u6253\u5f00\u5e94\u7528\u65b9\u5f0f\">\u6253\u5f00\u5e94\u7528\u65b9\u5f0f<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"api-\u4f7f\u7528-3\">API \u4f7f\u7528<\/h3>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"\u63a7\u5236\u53f0\u4f7f\u7528-2\">\u63a7\u5236\u53f0\u4f7f\u7528<\/h4>\n\n\n\n<p>\u8fdb\u5165\u3010\u6d88\u606f\u63a8\u9001\u3011-\u3010\u63a8\u9001\u7ba1\u7406\u3011-\u3010\u521b\u5efa\u63a8\u9001\u3011\u9875\u9762\uff0c\u9009\u62e9 Android \u5e73\u53f0\uff0c \u5e76\u5728 \u201cAndroid \u70b9\u51fb\u901a\u77e5\u6253\u5f00\u201d\u4e2d\u9009\u62e9\u201c\u6253\u5f00\u5e94\u7528\u201d\u3002\u00a0<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" width=\"1896\" height=\"442\" src=\"https:\/\/kb.cdn.yimenapp.com\/yimen\/2022\/12\/20221222151452648.png\" alt=\"\" class=\"wp-image-15840\"\/><\/figure>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"api-\u4f7f\u7528-4\">API \u4f7f\u7528<\/h4>\n\n\n\n<ul class=\"wp-block-list\"><li>SDK \u2265 4.2.2 \u7684\u7248\u672c\uff0c\u53ea\u9700\u8981\u586b\u5199 intent \u53c2\u6570\uff0c\u53c2\u6570\u8be6\u60c5\u53c2\u8003&nbsp;<a href=\"https:\/\/docs.jiguang.cn\/jpush\/practice\/intent#api-%E4%BD%BF%E7%94%A8\">API \u4f7f\u7528<\/a>\u3002<\/li><li>SDK\uff1c4.2.2 \u7684\u7248\u672c\uff0c\u4e14\u914d\u7f6e\u8fc7 uri_activity \u548c uri_action \u8df3\u8f6c\u7684\uff0c\u53ea\u9700\u8981\u586b\u5199 uri_activity \u548c uri_action\u3002<\/li><\/ul>\n\n\n\n<pre class=\"wp-block-preformatted\">          <code>{\n    \"notification\": {\n        \"android\": {\n            \"alert\": \"hello, JPush!\",\n            \"title\": \"JPush test\",\n            \"intent\": {\n                \"url\": \"intent:#Intent;action=android.intent.action.MAIN;end\"\n            },\n            \"uri_activity\": \"cn.jiguang.jumptest.MainActivity\", \/\/\u517c\u5bb94.2.2\u4ee5\u4e0b\u7248\u672c\n            \"uri_action\": \"cn.jiguang.jumptest.MainActivity\" \/\/\u517c\u5bb94.2.2\u4ee5\u4e0b\u7248\u672c\n        }\n    }\n}\n<\/code>\n        <\/pre>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u6781\u5149\u5f3a\u70c8\u5efa\u8bae\u4f60\u5347\u7ea7 SDK \u81f3 4.6.0 \u53ca\u4ee5\u4e0a\u7248\u672c\uff0c\u5e76\u914d\u7f6e\u901a\u77e5\u8df3\u8f6c\u76ee\u6807\u5730\u5740\u6765\u5b9e\u73b0\u70b9\u51fb\u901a\u77e5\u8df3\u8f6c\u529f\u80fd\u3002<\/p>\n","protected":false},"author":1,"featured_media":15844,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[656],"tags":[157,7385,562],"special":[],"attr":[],"class_list":["post-15839","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-app36","tag-apptuisong","tag-7385","tag-jiguangtuisong","entry"],"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/www.yimenapp.com\/kb-yimen\/wp-json\/wp\/v2\/posts\/15839","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=15839"}],"version-history":[{"count":1,"href":"https:\/\/www.yimenapp.com\/kb-yimen\/wp-json\/wp\/v2\/posts\/15839\/revisions"}],"predecessor-version":[{"id":15845,"href":"https:\/\/www.yimenapp.com\/kb-yimen\/wp-json\/wp\/v2\/posts\/15839\/revisions\/15845"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.yimenapp.com\/kb-yimen\/wp-json\/wp\/v2\/media\/15844"}],"wp:attachment":[{"href":"https:\/\/www.yimenapp.com\/kb-yimen\/wp-json\/wp\/v2\/media?parent=15839"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.yimenapp.com\/kb-yimen\/wp-json\/wp\/v2\/categories?post=15839"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.yimenapp.com\/kb-yimen\/wp-json\/wp\/v2\/tags?post=15839"},{"taxonomy":"special","embeddable":true,"href":"https:\/\/www.yimenapp.com\/kb-yimen\/wp-json\/wp\/v2\/special?post=15839"},{"taxonomy":"attr","embeddable":true,"href":"https:\/\/www.yimenapp.com\/kb-yimen\/wp-json\/wp\/v2\/attr?post=15839"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}