{"id":1865,"date":"2015-01-28T00:25:36","date_gmt":"2015-01-27T16:25:36","guid":{"rendered":"http:\/\/blog.qdac.cc\/?p=1865"},"modified":"2015-01-28T00:25:36","modified_gmt":"2015-01-27T16:25:36","slug":"%e8%af%91-%e8%8e%b7%e5%8f%96-andriod-%e4%b8%ad%e5%b7%b2%e7%bb%8f%e5%ae%89%e8%a3%85%e7%9a%84%e5%ba%94%e7%94%a8%e7%a8%8b%e5%ba%8f%e5%88%97%e8%a1%a8","status":"publish","type":"post","link":"https:\/\/blog.qdac.cc\/?p=1865","title":{"rendered":"[\u8bd1] \u83b7\u53d6 Andriod \u4e2d\u5df2\u7ecf\u5b89\u88c5\u7684\u5e94\u7528\u7a0b\u5e8f\u5217\u8868"},"content":{"rendered":"<p>\u539f\u6587\u94fe\u63a5\uff1ahttp:\/\/www.fmxexpress.com\/app-launcher-with-full-source-code-for-delphi-xe7-firemonkey-on-android<\/p>\n<p>\u5728 Andriod \u4e0a\u4e00\u4e2a\u7528\u6237\u6216 Delphi XE7 \u5f00\u53d1\u8005\u4e0d\u5f97\u4e0d\u9762\u5bf9\u7684\u95ee\u9898\u662f\uff0c\u5982\u679c\u4f60\u5b89\u88c5\u4e86\u592a\u591a\u7684\u5e94\u7528\u7a0b\u5e8f\uff0c\u90a3\u4e48\u4f60\u4e0d\u5f97\u4e0d\u5728\u56fe\u6807\u9875\u95f4\u5207\u6362\u4ee5\u627e\u5230\u60f3\u8981\u6253\u5f00\u7684\u5e94\u7528\u7a0b\u5e8f\u3002\u4e00\u4e2a\u89e3\u51b3\u8fd9\u4e2a\u95ee\u9898\u7684\u6f14\u793a\u65b9\u6848\u8ba9\u4f60\u5f88\u5bb9\u6613\u7684\u627e\u5230\u6b63\u786e\u7684\u5e94\u7528\u3002\u4f60\u53ef\u4ee5\u8f93\u5165\u5c11\u91cf\u7684\u5b57\u7b26\u6765\u6253\u5f00\u5e94\u7528\u6765\u66ff\u4ee3\u5728\u56fe\u6807\u9875\u95f4\u5207\u6362\u67e5\u627e\u3002\u5b83\u64cd\u4f5c\u8d77\u6765\u7c7b\u4f3c\u4e8e Windows \u4e0b\u7684 \u5f00\u59cb|\u8fd0\u884c \u529f\u80fd\u3002\u8fd9\u4e2a\u5e94\u7528\u8ba9\u6211\u5728 oDesk \u4e0a\u82b1\u4e86 100 \u7f8e\u5143\u3002<\/p>\n<p>\u6b64\u5e94\u7528\u6f14\u793a\u4e86\u4e09\u5757\u4e0d\u540c\u7684\u529f\u80fd\uff0c\u5305\u62ec\u4ece\u8bbe\u5907\u4e0a\u8bfb\u53d6\u5df2\u5b89\u88c5\u7684\u5e94\u7528\u5217\u8868\uff0c\u52a0\u8f7d\u5e76\u7f13\u5b58\u6bcf\u4e2a\u5e94\u7528\u7684\u56fe\u6807\u548c\u6253\u5f00\u5e94\u7528\u81ea\u8eab\u3002\u6b64\u7a0b\u5e8f\u7684\u8fd9\u4e00\u529f\u80fd\u7531\u4e8e\u4f7f\u7528\u4e86 Android \u7279\u5b9a\u7684 JNI \uff0c\u6240\u4ee5\u53ea\u5de5\u4f5c\u5728Android\u4e0a\uff0c\u800c\u4e0d\u80fd\u5728\u5176\u5b83\u5e73\u53f0\uff08Windows, IOS, \u6216\u8005 Mac OSX\uff09\u3002\u8fd9\u4e00\u4ee3\u7801\u5e94\u8be5\u5728 AppMethod \u4e0a\u4e5f\u80fd\u5de5\u4f5c\u3002\u4e0b\u9762\u662f Andriod \u7684\u542f\u52a8\u4e00\u4e2a\u5e94\u7528\u7684\u4ee3\u7801\uff1a<\/p>\n<pre class=\"lang:delphi decode:true \">procedure TformMain.OpenApp(PackageName, AppName : JString);\r\nvar\r\n  Intent : JIntent;\r\n  NativeComponent : JComponentName;\r\nbegin\r\nIntent := TJIntent.Create;\r\nIntent.setAction(TJIntent.JavaClass.ACTION_MAIN);\r\nIntent.addCategory(TJIntent.JavaClass.CATEGORY_LAUNCHER);\r\nNativeComponent := TJComponentName.JavaClass.init(PackageName, AppName);\r\nIntent.addFlags(TJIntent.JavaClass.FLAG_ACTIVITY_NEW_TASK or TJIntent.JavaClass.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED);\r\nIntent.setComponent(NativeComponent);\r\nSharedActivity.startActivity(Intent);\r\nend;<\/pre>\n<p>\u4e0b\u9762\u7684\u51fd\u6570\u679a\u4e3e\u8bbe\u5907\u4e0a\u5b89\u88c5\u7684\u5e94\u7528\uff1a<\/p>\n<pre class=\"lang:delphi decode:true \">function TformMain.GetActivityAppList: JList;\r\nvar\r\n  tempList : JList;\r\n  Intent : JIntent;\r\nManager : JPackageManager;\r\nbegin\r\nIntent := TJIntent.Create;\r\nIntent.setAction(TJIntent.JavaClass.ACTION_MAIN);\r\nIntent.addCategory(TJIntent.JavaClass.CATEGORY_LAUNCHER);\r\nManager := SharedActivity.getPackageManager;\r\ntempList := nil;\r\ntempList := Manager.queryIntentActivities(Intent, 0);\r\nResult := tempList;\r\nend;<\/pre>\n<p>\u4f60\u5fc5\u9700\u81ea\u5df1\u4e0b\u8f7d\u6f14\u793a\u7a0b\u5e8f\u6765\u83b7\u53d6\u4ece\u6bcf\u4e2aApp\u4e2d\u7f13\u5b58\u56fe\u6807\u7684\u4ee3\u7801\uff1a<a href=\"http:\/\/www.fmxexpress.com\/wp-content\/uploads\/2015\/01\/PackageList.zip\">\u4e0b\u8f7d\u5b8c\u6574\u6e90\u7801<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u539f\u6587\u94fe\u63a5\uff1ahttp:\/\/www.fmxe [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"site-sidebar-layout":"default","site-content-layout":"","ast-site-content-layout":"default","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","ast-disable-related-posts":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"default","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"footnotes":""},"categories":[8,21],"tags":[136,304,303,57],"class_list":["post-1865","post","type-post","status-publish","format-standard","hentry","category-delphi","category-misc","tag-andriod","tag-304","tag-303","tag-57"],"views":6452,"_links":{"self":[{"href":"https:\/\/blog.qdac.cc\/index.php?rest_route=\/wp\/v2\/posts\/1865","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.qdac.cc\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.qdac.cc\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.qdac.cc\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.qdac.cc\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1865"}],"version-history":[{"count":1,"href":"https:\/\/blog.qdac.cc\/index.php?rest_route=\/wp\/v2\/posts\/1865\/revisions"}],"predecessor-version":[{"id":1872,"href":"https:\/\/blog.qdac.cc\/index.php?rest_route=\/wp\/v2\/posts\/1865\/revisions\/1872"}],"wp:attachment":[{"href":"https:\/\/blog.qdac.cc\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1865"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.qdac.cc\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1865"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.qdac.cc\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1865"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}