{"id":51,"date":"2010-05-11T10:17:09","date_gmt":"2010-05-11T02:17:09","guid":{"rendered":"http:\/\/www.myvoipapp.com\/blogs\/yxh\/?p=51"},"modified":"2019-02-12T20:11:58","modified_gmt":"2019-02-12T12:11:58","slug":"android%e5%bc%80%e5%8f%91%e6%8c%87%e5%af%bc%e9%9a%8f%e8%af%912-%e5%ba%94%e7%94%a8%e7%a8%8b%e5%ba%8f%e5%9f%ba%e6%9c%ac%e5%8e%9f%e7%90%864","status":"publish","type":"post","link":"https:\/\/www.myvoipapp.com\/blogs\/yxh\/2010\/05\/11\/android%e5%bc%80%e5%8f%91%e6%8c%87%e5%af%bc%e9%9a%8f%e8%af%912-%e5%ba%94%e7%94%a8%e7%a8%8b%e5%ba%8f%e5%9f%ba%e6%9c%ac%e5%8e%9f%e7%90%864\/","title":{"rendered":"Android\u5f00\u53d1\u6307\u5bfc\u968f\u8bd1(2) &#8212; \u5e94\u7528\u7a0b\u5e8f\u57fa\u672c\u539f\u7406(4)"},"content":{"rendered":"<p><strong>\u6fc0\u6d3b\u7ec4\u4ef6: Intents(\u610f\u56fe)<\/strong><\/p>\n<p>CP\u6536\u5230CR\u7684\u8bf7\u6c42\u65f6\u5c31\u53ef\u4ee5\u6fc0\u6d3b. \u5176\u4ed6\u4e09\u4e2a\u7ec4\u4ef6: \u884c\u4e3a, \u670d\u52a1\u4ee5\u53caBR\u90fd\u662f\u901a\u8fc7\u5f02\u6b65\u6d88\u606f\u6fc0\u6d3b, \u8fd9\u79cd\u6d88\u606f\u5c31\u662f&#8221;intent(\u610f\u56fe)&#8221;.<\/p>\n<p><strong>\u5173\u95ed\u7ec4\u4ef6<\/strong><\/p>\n<p>CP\u53ea\u5728\u76f8\u5e94CR\u8bf7\u6c42\u65f6\u5b58\u6d3b, BR\u53ea\u5728\u54cd\u5e94\u5e7f\u64ad\u6d88\u606f\u65f6\u5b58\u6d3b, \u56e0\u6b64\u5bf9\u5b83\u4eec\u800c\u8a00\u6ca1\u6709\u5fc5\u8981\u663e\u5f0f\u5730\u5173\u95ed\u8fd9\u4e9b\u7ec4\u4ef6.<\/p>\n<p>\u53e6\u4e00\u65b9\u9762, Activities\u63d0\u4f9b\u4e86\u7528\u6237\u754c\u9762. \u5b83\u4eec\u4e0e\u7528\u6237\u53ef\u80fd\u4f1a\u6709\u4e00\u4e2a\u957f\u671f\u7684\u4f1a\u8bdd\u8fc7\u7a0b, \u4f1a\u8bdd\u671f\u95f4\u5373\u4f7f\u662f\u7a7a\u95f2\u4e5f\u4ecd\u7136\u4fdd\u6301\u6fc0\u6d3b. \u7c7b\u4f3c\u7684, \u670d\u52a1\u4e5f\u53ef\u80fd\u4fdd\u6301\u8fd0\u884c\u5f88\u957f\u4e00\u6bb5\u65f6\u95f4. \u56e0\u6b64Android\u63d0\u4f9b\u65b9\u6cd5\u6709\u6301\u7eed\u5730\u5173\u95edActivity\u548c\u670d\u52a1.<\/p>\n<p>1. \u53ef\u4ee5\u8c03\u7528Activity\u7684finish()\u65b9\u6cd5\u5173\u95edActivity. \u4e00\u4e2aactivity\u53ef\u4ee5\u5173\u95ed\u53e6\u5916\u4e00\u4e2aactivity.<br \/>\n2. \u670d\u52a1\u53ef\u4ee5\u901a\u8fc7\u8c03\u7528stopSelf()\u7684\u65b9\u5f0f\u6765\u5173\u95ed\u81ea\u5df1, \u6216\u8005\u8c03\u7528Context.stopService()\u6765\u5173\u95ed.<\/p>\n<p>\u5982\u679c\u4e0d\u518d\u4f7f\u7528\u7ec4\u4ef6\u4e86, \u7cfb\u7edf\u4e5f\u53ef\u4ee5\u5173\u95ed\u5b83\u4eec, \u6216\u8005\u5f53Android\u5fc5\u987b\u56de\u6536\u5185\u5b58\u65f6\u4e5f\u4f1a\u5173\u95ed\u8fd9\u4e9b\u7ec4\u4ef6.<\/p>\n<p><strong>manifest\u6587\u4ef6 (?\u8fd0\u8d27\u5355\u6587\u4ef6)<\/strong><br \/>\nAndroid\u542f\u52a8\u4e00\u4e2a\u7a0b\u5e8f\u7ec4\u4ef6\u4e4b\u524d, \u9700\u8981\u77e5\u9053\u8fd9\u4e2a\u7ec4\u4ef6\u7684\u5b58\u5728. \u56e0\u6b64\u5e94\u7528\u7a0b\u5e8f\u9700\u8981\u5728\u4e00\u4e2amanifest\u6587\u4ef6\u4e2d\u58f0\u660e\u5b83\u4eec\u7684\u7ec4\u4ef6. manifest\u6587\u4ef6\u6253\u5305\u5728.apk\u6587\u4ef6\u4e2d, \u8be5\u6587\u4ef6(.apk)\u8fd8\u5305\u542b\u7a0b\u5e8f\u4ee3\u7801, \u6587\u4ef6\u4ee5\u53ca\u8d44\u6e90\u7b49.<\/p>\n<p>manifest\u6587\u4ef6\u662f\u4e00\u4e2a\u7ed3\u6784\u5316\u7684xml\u6587\u4ef6, \u5e76\u4e14\u603b\u662f\u547d\u540d\u4e3a&#8221;AndroidManifest.xml&#8221;. \u5b83\u6700\u4e3b\u8981\u7684\u4efb\u52a1\u5c31\u662f\u5c06\u5f53\u524d\u5e94\u7528\u7a0b\u5e8f\u7684\u7ec4\u4ef6\u60c5\u51b5\u544a\u8bc9Android\u7cfb\u7edf.<\/p>\n<p><strong>Intent\u8fc7\u6ee4<\/strong><br \/>\nIntent\u5bf9\u8c61\u53ef\u4ee5\u663e\u5f0f\u5730\u547d\u540d\u4e3a\u4e00\u4e2a\u76ee\u6807\u7ec4\u4ef6(Target Component), \u6b64\u65f6Android\u53ef\u4ee5\u901a\u8fc7manifest\u6587\u4ef6\u5bf9\u5b83\u8fdb\u884c\u64cd\u4f5c. \u4f46\u662f\u5982\u679c\u76ee\u6807\u6ca1\u6709\u663e\u5f0f\u547d\u540d, Android\u5c31\u5fc5\u987b\u8981\u67e5\u627e\u6700\u5408\u9002\u7684\u7ec4\u4ef6\u6765\u54cd\u5e94Intent, \u65b9\u6cd5\u5c31\u662f\u5c06Intent\u5bf9\u8c61\u4e0e\u6f5c\u5728\u76ee\u6807\u7684Intent filters(Intnet\u8fc7\u6ee4)\u8fdb\u884c\u6bd4\u8f83.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u6fc0\u6d3b\u7ec4\u4ef6: Intents(\u610f\u56fe) CP\u6536\u5230CR\u7684\u8bf7\u6c42\u65f6\u5c31\u53ef\u4ee5\u6fc0\u6d3b. \u5176\u4ed6\u4e09\u4e2a\u7ec4\u4ef6: \u884c\u4e3a, \u670d\u52a1\u4ee5\u53caBR\u90fd\u662f\u901a\u8fc7\u5f02\u6b65\u6d88\u606f\u6fc0\u6d3b, \u8fd9\u79cd\u6d88\u606f\u5c31\u662f&#8221;in&#8230;<\/p>\n<p class=\"read-more\"><a class=\"btn btn-default\" href=\"https:\/\/www.myvoipapp.com\/blogs\/yxh\/2010\/05\/11\/android%e5%bc%80%e5%8f%91%e6%8c%87%e5%af%bc%e9%9a%8f%e8%af%912-%e5%ba%94%e7%94%a8%e7%a8%8b%e5%ba%8f%e5%9f%ba%e6%9c%ac%e5%8e%9f%e7%90%864\/\"> Read More<span class=\"screen-reader-text\">  Read More<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[6],"tags":[11,26],"class_list":["post-51","post","type-post","status-publish","format-standard","hentry","category-6","tag-linux","tag-mobile"],"_links":{"self":[{"href":"https:\/\/www.myvoipapp.com\/blogs\/yxh\/wp-json\/wp\/v2\/posts\/51","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.myvoipapp.com\/blogs\/yxh\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.myvoipapp.com\/blogs\/yxh\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.myvoipapp.com\/blogs\/yxh\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.myvoipapp.com\/blogs\/yxh\/wp-json\/wp\/v2\/comments?post=51"}],"version-history":[{"count":2,"href":"https:\/\/www.myvoipapp.com\/blogs\/yxh\/wp-json\/wp\/v2\/posts\/51\/revisions"}],"predecessor-version":[{"id":1971,"href":"https:\/\/www.myvoipapp.com\/blogs\/yxh\/wp-json\/wp\/v2\/posts\/51\/revisions\/1971"}],"wp:attachment":[{"href":"https:\/\/www.myvoipapp.com\/blogs\/yxh\/wp-json\/wp\/v2\/media?parent=51"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.myvoipapp.com\/blogs\/yxh\/wp-json\/wp\/v2\/categories?post=51"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.myvoipapp.com\/blogs\/yxh\/wp-json\/wp\/v2\/tags?post=51"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}