{"id":74,"date":"2015-07-31T08:58:59","date_gmt":"2015-07-31T08:58:59","guid":{"rendered":"https:\/\/boochlin.com\/?p=74"},"modified":"2026-09-19T18:04:15","modified_gmt":"2026-09-19T18:04:15","slug":"android-intents-with-chrome","status":"publish","type":"post","link":"https:\/\/boochlin.com\/?p=74","title":{"rendered":"Android Intents with Chrome"},"content":{"rendered":"<p>\u8b93\u7db2\u9801\u53bb\u9023\u7d50 android ap<\/p>\n<p>\u9019\u662f\u9084\u883b\u6b63\u5e38\u7684\u9700\u6c42\u884d\u751f\uff0c\u4e3b\u8981\u53ef\u4ee5\u4f86\u770b google play store \uff0c\u7576\u4f60\u5728\u901b\u4e00\u4e9bapp \u4ecb\u7d39\u6642<\/p>\n<p>\u770b\u5230link\u76f4\u63a5\u9ede\u4e0b\u53bb\uff0c\u901a\u5e38\u6709\u5169\u7a2e\u53ef\u80fd<\/p>\n<ol>\n<li>\n<p>\u76f4\u63a5\u958b\u555f\u65b0\u5206\u9801\u5230 play store \u4e0b\u8f09\u9801\u9762<\/p>\n<\/li>\n<li>\n<p>\u555f\u52d5play store app \uff0c\u7136\u5f8c\u9032\u5165\u4e0b\u8f09\u9801\u9762<\/p>\n<\/li>\n<\/ol>\n<p>\u9019\u6b21\u8981\u8ac7\u7684\u5c31\u662f\u7b2c\u4e8c\u9ede<\/p>\n<h3><strong>\u5982\u4f55\u8b93\u7db2\u9801\u7684\u9023\u7d50\u5177\u6709\u958b\u555fapp\u7684\u6548\u529b<\/strong><\/h3>\n<p><a href=\"https:\/\/developer.chrome.com\/multidevice\/android\/intents\">\u82f1\u6587\u5b98\u7db2<\/a><\/p>\n<p><a href=\"https:\/\/developers.google.com\/app-indexing\/webmasters\/app?hl=zh-tw\">\u4e2d\u6587\u5b98\u7db2<\/a><\/p>\n<p>\u4e2d\u6587\u5c45\u7136\u5beb\u7684\u6bd4\u8f03\u8a73\u7d30<\/p>\n<p>\u61f6\u7684\u770b\u5b98\u7db2\u7684\u8a71<\/p>\n<p>\u4ee5\u4e0b\u7bc0\u9304\u91cd\u9ede\uff0c\u4ee5\u53ca\u5f8c\u9762\u6e2c\u8a66\u5fc3\u5f97<\/p>\n<p>intent:<\/p>\n<p>HOST\/URI-path \/\/ Optional host<\/p>\n<p>#Intent;<\/p>\n<p>package=[string];<\/p>\n<p>action=[string];<\/p>\n<p>category=[string];<\/p>\n<p>component=[string];<\/p>\n<p>scheme=[string];<\/p>\n<p>end;<\/p>\n<p>\u5c0d\u61c9\u5230<\/p>\n<p>intent:<\/p>\n<p>\/\/scan\/<\/p>\n<p>#Intent;<\/p>\n<p>package=com.google.zxing.client.android;<\/p>\n<p>scheme=zxing;<\/p>\n<p>end;<\/p>\n<p>\u5beb\u51fa\u4f86\u61c9\u8a72\u6703\u50cf\u662f<\/p>\n<p>&lt;a href=\u201dintent:\/\/scan\/#Intent;scheme=zxing;package=com.google.zxing.client.android;end\u201d&gt; Take a QR code <\/a><\/p>\n<p>\u4e0a\u8ff0\u662fgoogle \u7684\u6559\u5b78\u8cc7\u6599 \u6839\u64da\u81ea\u5df1\u6e2c\u8a66\u7d50\u679c<\/p>\n<p>&lt;a href=\u201dintent:\/\/com.android.launcher3\/#Intent;scheme=http;action=com.android.ACTION.LAUNCH_LEFTPAGE;end;\u201d&gt;<\/p>\n<p>start launcher<\/a><\/p>\n<p>\u5982\u679c\u5c0d\u61c9\u5230\u81ea\u5df1\u76f8\u95dc\u7684ap \uff0c\u5fc5\u9808\u5148\u5728 android manifest \u88e1\u52a0\u5165 intent filter<\/p>\n<p><intent-filter><action android:name=\u201dandroid.intent.action.VIEW\u201d \/><action android:name=\u201dcom.android.ACTION.LAUNCH_LEFTPAGE\u201d \/><\/p>\n<p>&lt;data android:scheme=\u201dhttp\u201d<\/p>\n<p>android:host=\u201dcom.android.launcher3\u2033\/&gt;<\/p>\n<p><category android:name=\u201dandroid.intent.category.DEFAULT\u201d \/><category android:name=\u201dandroid.intent.category.BROWSABLE\u201d \/><\/intent-filter><\/p>\n<p>\u4ee5\u4e0a\u662f\u6700\u57fa\u672c\u7684\u914d\u7f6e\u8cc7\u6599 \u5982\u679c\u4f60\u6210\u529f\u52a0\u5165\u5230\u4f60\u7684app \u4e4b\u5f8c\uff0c\u53ef\u4ee5\u5148\u7528 adb \u4f86\u9032\u884c\u6e2c\u8a66<\/p>\n<pre><code class=\"hljs language-bash\">adb shell am start -a com.android.ACTION.LAUNCH_APP -d <span class=\"hljs-string\">&quot;http:\/\/com.android.launcher3&quot;<\/span><\/code><\/pre>\n<p>\u9019\u6a23\u61c9\u8a72\u6703\u6210\u529f\u958b\u555f\u4f60\u7684app<\/p>\n<p>\u63a5\u8005\u9032\u5165\u6b63\u984c<\/p>\n<p><a href=\"intent:\/\/com.android.launcher3\/#Intent;action=com.android.ACTION.LAUNCH_APP;scheme=http;end\">start your app<\/a><\/p>\n<p>\u9ede\u64ca\u4e0a\u8ff0\u9023\u7d50\uff0c\u61c9\u8a72\u5c31\u6703\u958b\u555f\u4f60\u7684activity.<\/p>\n<p>\u5176\u4ed6\u88dc\u5145\u4e8b\u9805\uff1a<\/p>\n<p>1.<action android:name=\u201candroid.intent.action.VIEW\u201d \/><\/p>\n<p>\u53ef\u52a0\u53ef\u4e0d\u52a0\uff0c\u9019\u53ea\u662f\u591a\u5c0d\u61c9\u4e00\u7a2e view action.(\u901a\u5e38browser\u6703\u767c)<\/p>\n<p>2.<category android:name=\u201candroid.intent.category.BROWSABLE\u201d \/><\/p>\n<p>\u9019\u500b\u4e00\u5b9a\u8981\u52a0\uff0c\u57fa\u672c\u4e0a\u9019\u5c31\u662f\u898f\u5247<\/p>\n<p>Only activities that have the category filter, android.intent.category.BROWSABLE are able to be invoked using this method as it indicates that the application is safe to open from the Browser.<\/p>\n<p>3.<category android:name=\u201candroid.intent.category.DEFAULT\u201d \/><\/p>\n<p>\u9019\u500b\u57fa\u672c\u4e0a\u5df2\u7d93\u662f\u5c0dandroid \u4e86\u4e0d\u4e86\u89e3\u7684\u554f\u984c\uff0c\u4e0d\u52a0\u7684\u8a71 app \u7121\u6cd5\u958b\u555f\u9019\u500bactivity.<\/p>\n<ol start=\"4\">\n<li>host \u662f\u4e0d\u4e00\u5b9a\u8981\u52a0\uff0c\u4f46\u662f\u6c92\u6709host \u5c31\u4e00\u5b9a\u8981\u52a0 path (\u53ef\u4ee5\u53c3\u8003<a href=\"https:\/\/developer.chrome.com\/multidevice\/android\/intents\">\u5b98\u7db2<\/a>\u7684\u5169\u7a2e\u5beb\u6cd5)<\/li>\n<\/ol>\n<p>\u4e5f\u53ef\u4ee5\u53ea\u6709host<\/p>\n<p>\u5176\u4ed6\u795e\u5947\u60c5\u6cc1\uff1a<\/p>\n<p>1.\u4f60\u8aaa\u4f60\u9ede\u4e86\u4e0a\u9762\u7684\u9023\u7d50 app \u537b\u6c92\u6709\u53cd\u61c9<\/p>\n<p>\u5ee2\u8a71\uff0c\u4f60\u5728\u96fb\u8166\u4e0a\u9762\u7528\u6ed1\u9f20\u9ede\u64ca\u7576\u7136\u6c92\u5c41\u7528\u963f<\/p>\n<p>2.\u4f60\u8aaa\u4f60\u5728\u624b\u6a5f\u4e0a\u9762\u958b\u5b98\u65b9browser\u9ede\u64ca\u4e86\u963f\uff0capp \u9084\u662f\u6c92\u53cd\u61c9<\/p>\n<p>\u4f60\u7684browser\u53ef\u80fd\u6c92porting \u9019\u6bb5<a href=\"https:\/\/code.google.com\/p\/android-source-browsing\/source\/browse\/core\/java\/android\/content\/Intent.java?repo=platform--frameworks--base#6514\">code<\/a><\/p>\n<p>3.\u4f60\u8aaa\u4f60\u958b chrome \u624d\u53bb\u9ede\u64ca\u7684<\/p>\n<p>\u5509\uff0c\u9019\u529f\u80fd\u4e5f\u662fgoogle \u5f8c\u4f86\u624d\u60f3\u5230\u7684\uff0c\u53bb\u66f4\u65b0\u4e00\u4e0b\u4f60\u7684chrome<\/p>\n<p>4.\u4f60\u8aaa\u5176\u4ed6browser\uff08firefox,\u767e\u5ea6\uff09\u9ede\u64ca\u4e86\u6c92\u7528<\/p>\n<p>\u7cdf\u7cd5\uff0c\u5176\u4ed6browser\u7576\u7136\u6c92\u6709parsing\u9019\u6bb5\u7db2\u9801\u7684\u529f\u80fd\uff0c\u9019\u529f\u80fd\u57fa\u672c\u4e0a\u53ea\u6709 chrome , \u539f\u751fbrowser \u6703 support.<\/p>\n<p>5.\u4ee5\u4e0a\u6211\u90fd\u6709\u641e\u5b9a\uff0c\u4f46\u9084\u662f\u4e0d\u80fd\u7528<\/p>\n<p>\u90a3\u61c9\u8a72\u662f\u6211\u7684\u554f\u984c\uff0c\u62b1\u6b49\uff0c\u4f60\u53ef\u4ee5\u7559\u8a00\u53cd\u61c9\uff0c\u8b1d\u8b1d<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u8b93\u7db2\u9801\u53bb\u9023\u7d50 android ap \u9019\u662f\u9084\u883b\u6b63\u5e38\u7684\u9700\u6c42\u884d\u751f\uff0c\u4e3b\u8981\u53ef\u4ee5\u4f86\u770b google play store  [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[168],"tags":[197,240],"_links":{"self":[{"href":"https:\/\/boochlin.com\/index.php?rest_route=\/wp\/v2\/posts\/74"}],"collection":[{"href":"https:\/\/boochlin.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/boochlin.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/boochlin.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/boochlin.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=74"}],"version-history":[{"count":4,"href":"https:\/\/boochlin.com\/index.php?rest_route=\/wp\/v2\/posts\/74\/revisions"}],"predecessor-version":[{"id":1565,"href":"https:\/\/boochlin.com\/index.php?rest_route=\/wp\/v2\/posts\/74\/revisions\/1565"}],"wp:attachment":[{"href":"https:\/\/boochlin.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=74"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/boochlin.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=74"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/boochlin.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=74"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}