{"id":1877,"date":"2023-03-30T22:35:40","date_gmt":"2023-03-30T14:35:40","guid":{"rendered":"https:\/\/www.appblog.cn\/?p=1877"},"modified":"2023-04-22T09:02:58","modified_gmt":"2023-04-22T01:02:58","slug":"h5-summarise-app-technology-deeplink-solution-summary","status":"publish","type":"post","link":"https:\/\/www.appblog.cn\/index.php\/2023\/03\/30\/h5-summarise-app-technology-deeplink-solution-summary\/","title":{"rendered":"H5\u5524\u8d77App\u6280\u672fDeepLink\u65b9\u6848\u603b\u7ed3"},"content":{"rendered":"<p>\u5524\u9192\u65b9\u5f0f\uff1a<\/p>\n<blockquote>\n<p>1\u3001URL Schemes<br \/>\n2\u3001android appLink<br \/>\n3\u3001chrome intent<\/p>\n<\/blockquote>\n<h2>DeepLink\u5b9e\u8df5URL Schemes\u65b9\u5f0f<\/h2>\n<p><!-- more --><\/p>\n<h3>\u9700\u8981\u5728AndroidManifest.xml\u6587\u4ef6\u8fdb\u884c\u914d\u7f6e<\/h3>\n<pre><code class=\"language-xml\">&lt;activity\n    android:name=&quot;.ui.activity.SplashActivity&quot;\n    android:exported=&quot;true&quot;\n    android:screenOrientation=&quot;portrait&quot;\n    android:theme=&quot;@style\/NormalSplash&quot;&gt;\n\n    &lt;intent-filter&gt;\n        &lt;action android:name=&quot;android.intent.action.MAIN&quot; \/&gt;\n        &lt;category android:name=&quot;android.intent.category.LAUNCHER&quot; \/&gt;\n    &lt;\/intent-filter&gt;\n\n    &lt;!--DeepLink h5\u5524\u9192app\u914d\u7f6e--&gt;\n    &lt;intent-filter&gt;\n        &lt;!--ACTION_VIEW\uff1a\u652f\u6301\u88ab\u68c0\u7d22--&gt;\n        &lt;action android:name=&quot;android.intent.action.VIEW&quot; \/&gt;\n        &lt;!--CATEGORY_DEFAULT\uff1a\u54cd\u5e94\u9690\u5f0fIntent--&gt;\n        &lt;category android:name=&quot;android.intent.category.DEFAULT&quot; \/&gt;\n        &lt;!--CATEGORY_BROWSABLE\uff1a\u53ef\u88abWeb\u6d4f\u89c8\u5668\u5524\u8d77--&gt;\n        &lt;category android:name=&quot;android.intent.category.BROWSABLE&quot; \/&gt;\n        &lt;!--data\uff1a\u4e00\u4e2a\u6216\u591a\u4e2a\uff0c\u5fc5\u987b\u542b\u6709scheme\u6807\u7b7e\uff0c\u51b3\u5b9a\u88ab\u5524\u8d77\u7684URL\u683c\u5f0f--&gt;\n        &lt;data\n            android:host=&quot;app.puxinwangxiao.com&quot;\n            android:scheme=&quot;pxwxstudent&quot; \/&gt;\n        &lt;!--    \n        &lt;data\n            android:host=&quot;app.puxinwangxiao.com&quot;\n            android:scheme=&quot;pxwxstudent&quot; \n            android:pathPrefix=&quot;\/pxwx&quot;\/&gt;\n        &lt;data\n            android:host=&quot;app.puxinwangxiao.com&quot;\n            android:scheme=&quot;pxwxstudent&quot; \n            android:path=&quot;\/pxwx\/user&quot;\/&gt;\n        --&gt;\n    &lt;\/intent-filter&gt;\n&lt;\/activity&gt;<\/code><\/pre>\n<p>\u6ce8\u610f\uff1a<\/p>\n<ul>\n<li>App\u53ef\u4ee5\u914d\u7f6e\u591a\u4e2a\u652f\u6301\u5524\u8d77\u7684Activity<\/li>\n<li>Activity\u53ef\u4ee5\u652f\u6301\u88ab\u591a\u4e2aURL\u5524\u8d77<\/li>\n<li>\u82e5\u4e00\u4e2aApp\u914d\u7f6e\u4e86\u591a\u4e2a\u652f\u6301\u5524\u8d77\u7684Activity\uff0c\u5b83\u4eec\u7684scheme\u548chost\u4e00\u822c\u4e00\u81f4\uff0c\u7136\u540e\u901a\u8fc7path\u3001pathPrefix\u7b49\u8fdb\u884c\u5b9a\u5411\u533a\u5206<\/li>\n<\/ul>\n<h3>\u88ab\u5524\u8d77\u540e\u89e3\u6790URL\u6570\u636e<\/h3>\n<p>Uri\u6570\u636e\u7684\u89e3\u6790\u53ef\u4ee5\u5728Activity\u4e2d\u901a\u8fc7<code>getIntent().getData()<\/code>\u5b9e\u73b0<\/p>\n<pre><code class=\"language-java\">@Override \npublic void onCreate(Bundle savesInstanceState) {\n    super.onCreate(savedInstanceState);\n    setContentView(R.layout.activity_splash);\n\n    \/\/ \u5c1d\u8bd5\u83b7\u53d6WebApp\u9875\u9762\u4e0a\u8fc7\u6765\u7684URL\n    Uri uri = getIntent().getData();\n    if (uri != null) {\n        \/\/ scheme\u90e8\u5206\n        String scheme = data.getScheme();\n        \/\/ host\u90e8\u5206\n        String host = data.getHost();\n        \/\/ \u8bbf\u95ee\u8def\u5f84\n        String path = data.getPath();\n        \/\/\u53c2\u6570\n        Set&lt;String&gt; paramKeySet = data.getQueryParameterNames();\n    }\n}<\/code><\/pre>\n<h3>\u5728h5\u9875\u9762\u4e0a\uff0c\u901a\u8fc7\u5982\u4e0b\u65b9\u5f0f\u4f7f\u7528<\/h3>\n<pre><code class=\"language-html\">&lt;!--1.\u901a\u8fc7a\u6807\u7b7e\u6253\u5f00\uff0c\u70b9\u51fb\u6807\u7b7e\u662f\u542f\u52a8--&gt;\n&lt;!-- \u6ce8\u610f\u8fd9\u91cc\u7684href\u683c\u5f0f -- &gt;\n&lt;a href=&quot;pxwxstudent:\/\/app.puxinwangxiao.com&quot;&gt;open android app&lt;\/a&gt;\n\n&lt;!--2.\u901a\u8fc7iframe\u6253\u5f00\uff0c\u8bbe\u7f6eiframe.src\u5373\u4f1a\u542f\u52a8--&gt;\n&lt;iframe src=&quot;pxwxstudent:\/\/app.puxinwangxiao.com&quot;&gt;&lt;\/iframe&gt;\n\n&lt;!--3.\u76f4\u63a5\u901a\u8fc7window.location \u8fdb\u884c\u8df3\u8f6c--&gt;\nwindow.location.href=&quot;pxwxstudent:\/\/app.puxinwangxiao.com&quot;;<\/code><\/pre>\n<h3>\u5728\u539f\u751fApp\u4e2d\u5524\u8d77\u901a\u8fc7Intent\u65b9\u5f0f<\/h3>\n<pre><code class=\"language-java\">Intent intent = new Intent();\nintent.setData(Uri.parse(&quot;pxwxstudent:\/\/app.puxinwangxiao.com\/&quot;));\nintent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);\nstartActivity(intent);<\/code><\/pre>\n<h2>DeepLink\u5b9e\u8df5Android AppLink\u65b9\u5f0f<\/h2>\n<h3>Android AppLink\u4ecb\u7ecd<\/h3>\n<ul>\n<li>Android M\u4ee5\u4e0a\u7248\u672c\u53ef\u4ee5\u901a\u8fc7AppLinks\uff0c\u8ba9\u7528\u6237\u5728\u70b9\u51fb\u4e00\u4e2a\u94fe\u63a5\u65f6\u8df3\u8f6c\u5230App\u7684\u6307\u5b9a\u9875\u9762<\/li>\n<li>\u524d\u63d0\u662f\u8fd9\u4e2aApp\u5df2\u7ecf\u5b89\u88c5\u5e76\u7ecf\u8fc7\u9a8c\u8bc1<\/li>\n<li>App Links\u7684\u6700\u5927\u4f5c\u7528\uff0c\u5c31\u662f\u53ef\u4ee5\u907f\u514d\u4ece\u9875\u9762\u5524\u9192App\u65f6\u51fa\u73b0\u7684\u9009\u62e9\u6d4f\u89c8\u5668\u9009\u9879\u6846;<\/li>\n<li>\u524d\u63d0\u662f\u5fc5\u987b\u6ce8\u518c\u76f8\u5e94\u7684Scheme\uff0c\u5c31\u53ef\u4ee5\u5b9e\u73b0\u76f4\u63a5\u6253\u5f00\u5173\u8054\u7684App<\/li>\n<\/ul>\n<p>Android App Links\u6709\u4ee5\u4e0b\u51e0\u70b9\u597d\u5904\uff1a<\/p>\n<ul>\n<li>\u5b89\u5168\u6027\/\u7279\u6b8a\u6027\uff1a\u7531\u4e8eAndroid App Links\u4f7f\u7528\u4e86HTTP\/HTTPS URL\u7684\u65b9\u5f0f\u5411\u5f00\u53d1\u8005\u7684\u670d\u52a1\u5668\u8fdb\u884c\u8fde\u63a5\u8ba4\u8bc1\uff0c\u6240\u4ee5\u5176\u4ed6\u5e94\u7528\u65e0\u6cd5\u4f7f\u7528\u6211\u4eec\u7684\u94fe\u63a5<\/li>\n<li>\u65e0\u7f1d\u7684\u7528\u6237\u4f53\u9a8c\uff1a\u5f53\u7528\u6237\u672a\u5b89\u88c5\u6211\u4eec\u7684\u5e94\u7528\u65f6\uff0c\u7531\u4e8e\u4f7f\u7528\u7684\u662fHTTP\/HTTPS URL\uff0c\u4f1a\u76f4\u63a5\u6253\u5f00\u4e00\u4e2a\u7f51\u9875\uff0c\u6211\u4eec\u53ef\u4ee5\u5728\u8fd9\u4e2a\u7f51\u9875\u4e2d\u5c55\u793a\u5e94\u7528\u4ecb\u7ecd\u7b49\uff0c\u800c\u4e0d\u662f\u663e\u793a404\u6216\u8005\u662f\u5176\u4ed6\u9519\u8bef\u9875\u9762<\/li>\n<li>\u652f\u6301Instant Apps\uff1a\u53ef\u4ee5\u4f7f\u7528App Links\u76f4\u63a5\u6253\u5f00\u4e00\u4e2a\u672a\u5b89\u88c5\u7684Instant App<\/li>\n<li>\u652f\u6301Google Search\u6216\u5176\u4ed6\u6d4f\u89c8\u5668\uff1a\u7528\u6237\u53ef\u4ee5\u76f4\u63a5\u5728Google Search\/Google Assistant\/\u624b\u673a\u6d4f\u89c8\u5668\/\u5c4f\u5e55\u641c\u7d22\u4e2d\u76f4\u63a5\u901a\u8fc7\u70b9\u51fb\u4e00\u4e2aURL\u6765\u6253\u5f00\u6211\u4eec\u7684\u6307\u5b9a\u9875\u9762<\/li>\n<\/ul>\n<h3>Android AppLink\u96c6\u6210<\/h3>\n<p><a target=\"_blank\" rel=\"noopener\" href=\"https:\/\/developer.android.com\/studio\/write\/app-link-indexing.html\">https:\/\/developer.android.com\/studio\/write\/app-link-indexing.html<\/a><\/p>\n<h4>\u521b\u5efaintent filter<\/h4>\n<p>\u6211\u4eec\u5728\u6b64\u5904\u5148\u5047\u8bbe\u7528\u6237\u662f\u901a\u8fc7<code>http:\/\/resource.puxinwangxiao.com\/pxwx<\/code>\u6765\u6253\u5f00\u6211\u4eec\u7684\u5e94\u7528\u7684\u3002<\/p>\n<p>Android Studio 2.3\u4ee5\u540e\u63d0\u4f9b\u4e86<code>App Links Assistant<\/code>\u6765\u5e2e\u52a9\u5f00\u53d1\u8005\u5feb\u901f\u5728<code>AndroidManifest.xml<\/code>\u4e2d\u521b\u5efa\u9700\u8981\u914d\u7f6e\u7684<code>intent filter<\/code>\uff0c\u4f7f\u7528<code>App Links Assistant<\/code>\u6709\u4ee5\u4e0b\u51e0\u4e2a\u6b65\u9aa4\uff1a<\/p>\n<ul>\n<li>\u70b9\u51fbAndroid Studio\u7684\u83dc\u5355\u680f\u4e2d\u7684 Tools &gt; App Links Assistant<\/li>\n<li>\u70b9\u51fbOpen URL Mapping Editor\uff0c\u7136\u540e\u5728\u5bf9\u8bdd\u6846\u5e95\u90e8\u70b9\u51fb+\u53bb\u6dfb\u52a0\u4e00\u4e2a\u65b0\u7684URL mapping<\/li>\n<li>\u5728\u5f39\u51fa\u7684Add URL Mapping\u5bf9\u8bdd\u6846\u4e2d\u8f93\u5165\u5bf9\u5e94\u7684\u5185\u5bb9\uff0c\u5305\u62ecHost\u3001Path\u3001Activity\uff0c\u8f93\u5165\u5b8c\u6210\u540e\u70b9\u51fbOK<\/li>\n<\/ul>\n<p><img decoding=\"async\" src=\"http:\/\/www.yezhou.me\/AppBlog\/images\/Android\/App%20Links%20Assistant%20-%20Add%20URL%20Mapping.png\" alt=\"App Links Assistant - Add URL Mapping\" \/><\/p>\n<blockquote>\n<p>\u6ce8\uff1aApp Link \u652f\u6301\u591a\u4e2a\u57df\u540d<\/p>\n<\/blockquote>\n<p>\u4f7f\u7528<code>App Links Assistant<\/code>\u5728manifest\u6587\u4ef6\u4e2d\u81ea\u52a8\u751f\u6210\u7684\u5185\u5bb9\u5982\u4e0b\uff1a<\/p>\n<pre><code class=\"language-xml\">&lt;activity\n    android:name=&quot;.ui.activity.SplashActivity&quot;\n    android:exported=&quot;true&quot;\n    android:screenOrientation=&quot;portrait&quot;\n    android:theme=&quot;@style\/NormalSplash&quot;&gt;\n    &lt;intent-filter&gt;\n        &lt;action android:name=&quot;android.intent.action.MAIN&quot; \/&gt;\n        &lt;category android:name=&quot;android.intent.category.LAUNCHER&quot; \/&gt;\n\n    &lt;\/intent-filter&gt;\n\n    &lt;intent-filter&gt;\n        &lt;action android:name=&quot;android.intent.action.VIEW&quot; \/&gt;\n        &lt;category android:name=&quot;android.intent.category.DEFAULT&quot; \/&gt;\n        &lt;category android:name=&quot;android.intent.category.BROWSABLE&quot; \/&gt;\n        &lt;data\n            android:scheme=&quot;http&quot;\n            android:host=&quot;resource.puxinwangxiao.com&quot;\n            android:path=&quot;\/pxwx&quot; \/&gt;\n    &lt;\/intent-filter&gt;\n&lt;\/activity&gt;<\/code><\/pre>\n<h4>\u68c0\u67e5URL Mapping\u662f\u5426\u914d\u7f6e\u6b63\u786e<\/h4>\n<p><code>App Links Assistant<\/code>\u63d0\u4f9b\u4e86\u68c0\u67e5URL Mapping\u662f\u5426\u914d\u7f6e\u6b63\u786e\u7684\u5feb\u6377\u65b9\u5f0f\uff0c\u64cd\u4f5c\u5982\u4e0b\uff1a<\/p>\n<p>\u70b9\u51fb<code>Open URL Mapping Editor<\/code>\uff0c\u7136\u540e\u5728<code>Check URL Mapping<\/code>\u5bf9\u8bdd\u6846\u4e2d\u8f93\u5165URL\uff0c\u5f53\u8f93\u5165\u4e00\u4e2a\u80fd\u591f\u6210\u529f\u5339\u914d\u5230Acitivty\u7684URL\u540e\uff0c\u8f93\u5165\u6846\u4e0b\u65b9\u4f1a\u663e\u793a<code>This URL maps to xxxxx(app)<\/code><\/p>\n<p><img decoding=\"async\" src=\"http:\/\/www.yezhou.me\/AppBlog\/images\/Android\/App%20Links%20Assistant%20-%20Check%20URL%20Mapping.png\" alt=\"App Links Assistant - Check URL Mapping\" \/><\/p>\n<h4>\u5904\u7406App Links\u8fdb\u5165\u5e94\u7528\u7684\u573a\u666f<\/h4>\n<p>\u901a\u8fc7<code>App Links Assistant<\/code> -&gt; <code>Select Activity<\/code>\u9009\u62e9\u4e4b\u524d\u914d\u7f6e\u7684URL\u5bf9\u5e94\u7684Activity\uff0c\u70b9\u51fbInsert Code\u5373\u53ef\u5728onCreate\u65b9\u6cd5\u4e2d\u63d2\u5165\u83b7\u53d6\u4eceApp Links\u8df3\u8f6c\u800c\u6765\u7684URL\u7684\u4ee3\u7801\uff0c\u751f\u6210\u4ee3\u7801\u5982\u4e0b<\/p>\n<pre><code class=\"language-java\">\/\/ ATTENTION: This was auto-generated to handle app links.\nIntent appLinkIntent = getIntent();\nString appLinkAction = appLinkIntent.getAction();\nUri appLinkData = appLinkIntent.getData();<\/code><\/pre>\n<h4>\u68c0\u67e5assetlinks.json\u662f\u5426\u4e0a\u4f20\u6210\u529f<\/h4>\n<p>\u4e3a\u4e86\u5728\u5e94\u7528\u5b89\u88c5\u6210\u529f\u540e\uff0c\u7cfb\u7edf\u80fd\u81ea\u52a8\u9a8c\u8bc1\u8be5\u5e94\u7528\u662f\u5426\u6709\u6743\u4f7f\u7528\u5bf9\u5e94\u7684\u57df\u540d\uff0c\u7cfb\u7edf\u4f1a\u5411<code>http:\/\/resource.puxinwangxiao.com\/.well-known\/assetlinks.json<\/code>\u8bf7\u6c42\u6570\u636e\uff0c\u6839\u636e\u83b7\u53d6\u5230\u7684\u6587\u4ef6\u5185\u5bb9\uff0c\u9a8c\u8bc1\u5e94\u7528\u57df\u540d\u7684\u5408\u6cd5\u6027\u3002<\/p>\n<p>\u901a\u8fc7<code>App Links Assistant<\/code> -&gt; <code>Open Digital Asset Links File Generator<\/code> -&gt; <code>Generate Digital Asset Links file<\/code>\u7684\u65b9\u5f0f\u751f\u6210<code>assetlinks.json<\/code>\u6587\u4ef6\uff0c\u7136\u540e\u5c06\u8be5\u6587\u4ef6\u653e\u7f6e\u5230\u6b63\u786e\u7684\u57df\u540d\u5730\u5740\u4e2d\u3002<\/p>\n<p>\u901a\u8fc7<code>App Links Assistant<\/code> -&gt; <code>Open Digital Asset Links File Generator<\/code> -&gt; <code>Generate Digital Asset Links file<\/code> -&gt; <code>Link and Verify<\/code>\u53ef\u4ee5\u68c0\u6d4b\u662f\u5426\u6b63\u786e\u7684\u5728\u670d\u52a1\u5668\u4e2d\u653e\u7f6e\u914d\u7f6e\u6587\u4ef6\uff0c\u68c0\u6d4b\u6210\u529f\u7684\u8bdd\uff0c\u663e\u793a\u5982\u4e0b\u56fe\uff1a<\/p>\n<p><img decoding=\"async\" src=\"http:\/\/www.yezhou.me\/AppBlog\/images\/Android\/App%20Links%20Assistant%20-%20Generate%20Digital%20Asset%20Links%20file.png\" alt=\"App Links Assistant - Generate Digital Asset Links file\" \/><\/p>\n<p>\u6211\u8fd9\u91cc\u68c0\u6d4b\u540e\u63d0\u793a<code>Network error.<\/code>\u4e0d\u5f71\u54cd\uff0c\u4e3b\u8981\u662f<code>http:\/\/resource.puxinwangxiao.com\/.well-known\/assetlinks.json<\/code>\u80fd\u8bbf\u95ee\u5230json\u6587\u4ef6<\/p>\n<p>\u5982\u679c\u8981\u8ba9\u7f51\u7ad9\u548c\u4e0d\u540c\u7684\u5e94\u7528\u5173\u8054\u8d77\u6765<\/p>\n<p>\u7f51\u7ad9\u53ef\u4ee5\u5728\u540c\u4e00\u4e2a<code>assetlinks.json<\/code>\u6587\u4ef6\u91cc\u58f0\u660e\u548c\u4e0d\u540c\u7684app\u7684\u5173\u7cfb\u3002\u4e0b\u9762\u8fd9\u4e2a\u6587\u4ef6\u5217\u51fa\u4e86\u4e24\u4e2a\u58f0\u660e\uff0c\u8fd9\u4e24\u4e2a\u58f0\u660e\u58f0\u660e\u4e86\u7f51\u7ad9\u548c\u4e24\u4e2a\u5e94\u7528\u4e4b\u95f4\u7684\u5173\u8054\uff0c\u8fd9\u4e2a\u6587\u4ef6\u4f4d\u4e8e<code>https:\/\/app-pre.puxinwangxiao.com\/.well-known\/assetlinks.json<\/code>\u3002<\/p>\n<pre><code class=\"language-json\">[{\n  &quot;relation&quot;: [&quot;delegate_permission\/common.handle_all_urls&quot;],\n  &quot;target&quot;: {\n    &quot;namespace&quot;: &quot;android_app&quot;,\n    &quot;package_name&quot;: &quot;com.pxwx.student&quot;,\n    &quot;sha256_cert_fingerprints&quot;:\n    [&quot;BD:EF:57:3D:01:D0:32:79:6E:32:73:18:32:E2:36:B9:35:1B:9C:7D:0F:F0:B0:A9:BE:91:18:CE:27:1A:D8:4C&quot;]\n  }\n},\n{\n  &quot;relation&quot;: [&quot;delegate_permission\/common.handle_all_urls&quot;],\n  &quot;target&quot;: {\n    &quot;namespace&quot;: &quot;android_app&quot;,\n    &quot;package_name&quot;: &quot;com.pxwx.assistant&quot;,\n    &quot;sha256_cert_fingerprints&quot;:\n    [&quot;BD:EF:57:3D:01:D0:32:79:6E:32:73:18:32:E2:36:B9:35:1B:9C:7D:0F:F0:B0:A9:BE:91:18:CE:27:1A:D8:4C&quot;]\n  }\n}]<\/code><\/pre>\n<h4>\u6ce8\u610f\uff1apath\u3001 pathPrefix\u3001 pathPattern \u4e4b\u95f4\u7684\u533a\u522b<\/h4>\n<p>\u4f8b\u5982\uff1a<a target=\"_blank\" rel=\"noopener\" href=\"https:\/\/app-pre.puxinwangxiao.com\/assistant\/download.html\">https:\/\/app-pre.puxinwangxiao.com\/assistant\/download.html<\/a><\/p>\n<ul>\n<li>path \u7528\u6765\u5339\u914d\u5b8c\u6574\u7684\u8def\u5f84\uff0c\u8fd9\u91cc\u5c06 path \u8bbe\u7f6e\u4e3a<code>\/assistant\/download.html<\/code>\u624d\u80fd\u591f\u8fdb\u884c\u5339\u914d<\/li>\n<li>pathPrefix \u7528\u6765\u5339\u914d\u8def\u5f84\u7684\u5f00\u5934\u90e8\u5206\uff0c\u62ff\u4e0a\u9762\u7684 Uri \u6765\u8bf4\uff0c\u8fd9\u91cc\u5c06 pathPrefix \u8bbe\u7f6e\u4e3a<code>\/assistant<\/code>\u5c31\u80fd\u8fdb\u884c\u5339\u914d\u4e86<\/li>\n<li>pathPattern \u7528\u8868\u8fbe\u5f0f\u6765\u5339\u914d\u6574\u4e2a\u8def\u5f84\uff0c\u8fd9\u91cc\u9700\u8981\u8bf4\u4e0b\u5339\u914d\u7b26\u53f7\u4e0e\u8f6c\u4e49<\/li>\n<\/ul>\n<h2>Chrome Intent\u65b9\u5f0f\u5b9e\u73b0\u4ece\u6d4f\u89c8\u5668\u542f\u52a8\u5e94\u7528<\/h2>\n<p>\u5728\u5f88\u591a\u5e94\u7528\u4e2d\u9700\u8981\u6211\u4eec\u4ece\u6d4f\u89c8\u5668\u4e2d\u76f4\u63a5\u542f\u52a8\u5e94\u7528\uff0c\u5927\u591a\u6570\u91c7\u7528\u7684\u662f\u4e0a\u9762\u63d0\u5230\u7684\u7b2c\u4e00\u79cdscheme\u7684\u65b9\u5f0f\uff0c\u95ee\u9898\u662f\u5982\u679c\u624b\u673a\u4e2d\u6ca1\u6709\u5e94\u7528\uff0c\u8be5url\u4f1a\u8df3\u8f6c\u5230\u4e00\u4e2a\u9519\u8bef\u7684\u754c\u9762\u3002<\/p>\n<p>Google\u5b98\u65b9\u5728chrome\u4e2d\u63a8\u51fa\u4e86\u4e00\u79cdAndroid Intents\u7684\u65b9\u5f0f\u6765\u5b9e\u73b0\u5e94\u7528\u542f\u52a8\uff0c\u901a\u8fc7\u5728iframe\u4e2d\u8bbe\u7f6esrc\u4e3a<\/p>\n<pre><code class=\"language-html\">intent:HOST\/URI-path \/\/ Optional host\n#Intent;\npackage=[string];\naction=[string];\ncategory=[string];\ncomponent=[string]; \nscheme=[string];\nend;<\/code><\/pre>\n<p>Mainfest\u6587\u4ef6\u4e2d\u5b9a\u4e49\u8981\u542f\u52a8\u7684Activity<\/p>\n<pre><code class=\"language-xml\">&lt;activity\n    android:name=&quot;.ui.activity.SplashActivity&quot;\n    android:exported=&quot;true&quot;\n    android:screenOrientation=&quot;portrait&quot;\n    android:theme=&quot;@style\/NormalSplash&quot;&gt;\n    &lt;intent-filter&gt;\n        &lt;action android:name=&quot;android.intent.action.MAIN&quot; \/&gt;\n        &lt;category android:name=&quot;android.intent.category.LAUNCHER&quot; \/&gt;\n    &lt;\/intent-filter&gt;\n\n    &lt;intent-filter&gt;\n        &lt;action android:name=&quot;android.intent.action.VIEW&quot; \/&gt;\n        &lt;category android:name=&quot;android.intent.category.DEFAULT&quot; \/&gt;\n        &lt;category android:name=&quot;android.intent.category.BROWSABLE&quot; \/&gt;\n        &lt;data\n            android:host=&quot;app.puxinwangxiao.com&quot;\n            android:scheme=&quot;pxwxstudent&quot; \/&gt;\n    &lt;\/intent-filter&gt;\n&lt;\/activity&gt;<\/code><\/pre>\n<p>\u5b9a\u4e49\u4e00\u4e2aa\u6807\u7b7e\u4e3a<\/p>\n<pre><code class=\"language-html\">&lt;a href=&quot;intent:\/\/app.puxinwangxiao.com\/#Intent;scheme=pxwxstudent;package=com.xxx.xxx;end&quot;&gt;open Android App&lt;\/a&gt;<\/code><\/pre>\n<p>\u5728\u6d4f\u89c8\u5668\u4e2d\u70b9\u51fba\u6807\u7b7e\uff0c\u5c31\u53ef\u4ee5\u542f\u52a8\u5e94\u7528\u7a0b\u5e8f\u7684\u5bf9\u5e94activity\u4e86.<\/p>\n<p>\u5982\u679c\u624b\u673a\u4e2d\u6ca1\u6709\u76f8\u5e94\u7684\u5e94\u7528\uff0c\u9632\u6b62\u8df3\u8f6c\u5230\u9519\u8bef\u9875\u9762\uff0c\u5c06a\u6807\u7b7e\u8bbe\u7f6e\u4e3a<\/p>\n<pre><code class=\"language-html\">&lt;a href=&quot;intent:\/\/app.puxinwangxiao.com\/#Intent;scheme=pxwxstudent;package=com.xxx.xxx;S.browser_fallback_url=https:\/\/www.puxinwangxiao.com;end&quot;&gt;open Android App&lt;\/a&gt;<\/code><\/pre>\n<p>\u8fd9\u6837\u5982\u679c\u6ca1\u6709\u5bf9\u5e94\u5e94\u7528\uff0c\u8be5\u94fe\u63a5\u5c31\u4f1a\u8df3\u8f6c\u5230<code>S.browser_fallback_url<\/code>\u6307\u5b9a\u7684url\u4e0a\u3002<\/p>\n<h2>\u603b\u7ed3\uff1a<\/h2>\n<h3>URL Scheme\u517c\u5bb9\u6027<\/h3>\n<p>URL Scheme\u53ea\u9700\u8981\u539f\u751fApp\u5f00\u53d1\u65f6\u6ce8\u518cScheme\u5373\u53ef\uff0c\u7528\u6237\u70b9\u51fb\u6b64\u7c7b\u94fe\u63a5\u65f6\uff0c\u4f1a\u81ea\u52a8\u5524\u9192App\uff0c\u5e76\u501f\u52a9URL Router\u673a\u5236\u8df3\u8f6c\u5230\u6307\u5b9a\u9875\u9762\u3002<\/p>\n<p>URL Scheme\u517c\u5bb9\u6027\u9ad8\uff0c\u4f46\u5374\u5b58\u5728\u8bb8\u591a\u9650\u5236\uff1a<\/p>\n<ul>\n<li>\u56fd\u5185\u5404\u4e2a\u5382\u5546\u6d4f\u89c8\u5668\u5dee\u5f02\u5f88\u5927\uff0c\u5f53\u8981\u88ab\u5524\u9192\u7684\u76ee\u6807App\u672a\u5b89\u88c5\u65f6\uff0c\u8fd9\u4e2a\u94fe\u63a5\u5f88\u5bb9\u6613\u51fa\u9519<\/li>\n<li>\u5f53\u6ce8\u518c\u6709\u591a\u4e2aScheme\u76f8\u540c\u7684\u65f6\u5019\uff0c\u76ee\u524d\u662f\u6ca1\u6709\u529e\u6cd5\u533a\u5206\u7684<\/li>\n<li>\u4e0d\u652f\u6301\u4ece\u5176\u4ed6App\u4e2d\u7684UIWebView\u4e2d\u8df3\u8f6c\u5230\u76ee\u6807App<\/li>\n<li>\u88ab\u90e8\u5206\u4e3b\u6d41\u5e73\u53f0\u7981\u6b62\uff0c\u5fae\u4fe1\u3001\u5fae\u535a\u3001QQ\u6d4f\u89c8\u5668\u3001\u624b\u673a\u767e\u5ea6\u4e2d\u90fd\u5df2\u7ecf\u88ab\u7981\u6b62\u4f7f\u7528<\/li>\n<\/ul>\n<p>\u7531\u4e8e\u8fd9\u4e9b\u9650\u5236\u7684\u5b58\u5728\uff0c\u5b89\u5353\u53d1\u5e03\u4e86\u81ea\u5df1\u7684\u7b2c\u4e8c\u5957\u65b9\u6848\uff1aAndroid\u7684App Links<\/p>\n<h3>App Links\u517c\u5bb9\u6027<\/h3>\n<ul>\n<li>App links\u5728\u56fd\u5185\u7684\u652f\u6301\u8fd8\u4e0d\u591f\uff0c\u90e8\u5206\u5b89\u5353\u6d4f\u89c8\u5668\u5e76\u4e0d\u652f\u6301\u8df3\u8f6c\u81f3App\uff0c\u800c\u662f\u76f4\u63a5\u5728\u6d4f\u89c8\u5668\u4e0a\u6253\u5f00\u5bf9\u5e94\u9875\u9762<\/li>\n<li>\u7cfb\u7edf\u8be2\u95ee\u662f\u5426\u6253\u5f00\u5bf9\u5e94App\u65f6\uff0c\u5047\u5982\u7528\u6237\u9009\u62e9\u201c\u53d6\u6d88\u201d\u5e76\u4e14\u9009\u4e2d\u4e86\u201c\u8bb0\u4f4f\u6b64\u64cd\u4f5c\u201d\uff0c\u90a3\u4e48\u7528\u6237\u4ee5\u540e\u5c31\u65e0\u6cd5\u518d\u8df3\u8f6cApp<\/li>\n<\/ul>\n<h3>chrome intent\u517c\u5bb9\u6027<\/h3>\n<ul>\n<li>Google\u901a\u8fc7chrome\u6d4f\u89c8\u5668\u542f\u52a8\u7684\u4f18\u5316\u65b9\u6848<\/li>\n<li>\u5f88\u591a\u7b2c\u4e09\u65b9\u6d4f\u89c8\u5668\u4f1a\u62e6\u622a\u6389chrome intent\u542f\u52a8\u5e94\u7528\u7684\u8bf7\u6c42<\/li>\n<\/ul>\n<p>\u4e09\u79cd\u65b9\u6848\u90fd\u6709\u5404\u81ea\u7684\u517c\u5bb9\u6027\uff0c\u8fd9\u51e0\u9879\u6280\u672f\u662f\u57fa\u4e8e\u7cfb\u7edf\u5e73\u53f0\u7684\uff0c\u6bcf\u4e2a\u7cfb\u7edf\u7248\u672c\u7684\u8fed\u4ee3\u540e\uff0c\u914d\u7f6e\u65b9\u5f0f\u90fd\u4f1a\u6709\u65b0\u7684\u53d8\u5316\uff0c\u56fd\u5185\u7684\u7b2c\u4e09\u65b9\u5e73\u53f0openinstall\u4e5f\u63d0\u4f9b\u4e86\u4e13\u9879\u529f\u80fd\uff0c\u6bd5\u7adf\u662f\u4e13\u95e8\u505a\u8fd9\u4e2a\u7684\uff0c\u517c\u5bb9\u6027\u4e5f\u90fd\u7ecf\u53d7\u8fc7\u5e02\u573a\u8003\u9a8c\uff0c\u53ef\u4ee5\u53c2\u8003\u4e0b\u3002<\/p>\n<blockquote>\n<p>\u8f6c\u8f7d\u81f3\uff1a<a target=\"_blank\" rel=\"noopener\" href=\"https:\/\/mp.weixin.qq.com\/s\/Cx9aIcfQVDaCqXV4atmIPQ\">https:\/\/mp.weixin.qq.com\/s\/Cx9aIcfQVDaCqXV4atmIPQ<\/a><\/p>\n<\/blockquote>\n","protected":false},"excerpt":{"rendered":"<p>\u5524\u9192\u65b9\u5f0f\uff1a 1\u3001URL Schemes 2\u3001android appLink 3\u3001chrome intent D [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[311],"tags":[481,159],"class_list":["post-1877","post","type-post","status-publish","format-standard","hentry","category-android-advance","tag-deeplink","tag-h5"],"_links":{"self":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/posts\/1877","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/comments?post=1877"}],"version-history":[{"count":0,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/posts\/1877\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/media?parent=1877"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/categories?post=1877"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/tags?post=1877"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}