{"id":13430,"date":"2022-11-29T15:35:41","date_gmt":"2022-11-29T07:35:41","guid":{"rendered":"https:\/\/www.yimenapp.com\/kb-yimen\/?p=13430"},"modified":"2022-11-29T15:35:42","modified_gmt":"2022-11-29T07:35:42","slug":"%e5%be%ae%e4%bf%a1%e5%bc%80%e6%94%be%e5%b9%b3%e5%8f%b0app%e6%8b%89%e8%b5%b7%e5%b0%8f%e7%a8%8b%e5%ba%8f%e5%8a%9f%e8%83%bd-android%e5%bc%80%e5%8f%91%e7%a4%ba%e4%be%8b","status":"publish","type":"post","link":"https:\/\/www.yimenapp.com\/kb-yimen\/13430\/","title":{"rendered":"\u5fae\u4fe1\u5f00\u653e\u5e73\u53f0APP\u62c9\u8d77\u5c0f\u7a0b\u5e8f\u529f\u80fd\u00a0\/Android\u5f00\u53d1\u793a\u4f8b"},"content":{"rendered":"\n<p>\u5fae\u4fe1\u5f00\u653e\u5e73\u53f0<span class=\"wpcom_tag_link\"><a href=\"https:\/\/www.yimenapp.com\/kb-yimen\/tag\/app%e6%8b%89%e8%b5%b7%e5%b0%8f%e7%a8%8b%e5%ba%8f\/\" title=\"APP\u62c9\u8d77\u5c0f\u7a0b\u5e8f\" target=\"_blank\">APP\u62c9\u8d77\u5c0f\u7a0b\u5e8f<\/a><\/span>\u529f\u80fd\u00a0\/<span class=\"wpcom_keyword_link\"><a href=\"https:\/\/android.yimenapp.com\" title=\"Android\u5f00\u53d1\u4ece\u4e00\u95e8\u5f00\u59cb\">Android\u5f00\u53d1<\/a><\/span>\u793a\u4f8b<\/p>\n\n\n\n<p>\u5f00\u53d1\u524d\u9700\u4e0b\u8f7d Android \u5f00\u53d1\u5de5\u5177\u5305\uff08SDK\uff09\uff0c\u53ef<a href=\"https:\/\/developers.weixin.qq.com\/doc\/oplatform\/Downloads\/Android_Resource.html\" target=\"_blank\" rel=\"noreferrer noopener\">\u524d\u5f80\u4e0b\u8f7d<\/a><\/p>\n\n\n\n<p>\u8c03\u7528\u63a5\u53e3\uff1a<span class=\"wpcom_tag_link\"><a href=\"https:\/\/www.yimenapp.com\/kb-yimen\/tag\/wxlaunchminiprogram\/\" title=\"WXLaunchMiniProgram\" target=\"_blank\">WXLaunchMiniProgram<\/a><\/span> \u79fb\u52a8\u5e94\u7528\u8df3\u8f6c\u5230<span class=\"wpcom_tag_link\"><a href=\"https:\/\/www.yimenapp.com\/kb-yimen\/tag\/%e5%b0%8f%e7%a8%8b%e5%ba%8f\/\" title=\"\u5c0f\u7a0b\u5e8f\" target=\"_blank\">\u5c0f\u7a0b\u5e8f<\/a><\/span>\u793a\u4f8b\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>String appId = \"wxd930ea5d5a258f4f\"; \/\/ \u586b\u79fb\u52a8\u5e94\u7528(App)\u7684 AppId\uff0c\u975e\u5c0f\u7a0b\u5e8f\u7684 AppID\nIWXAPI api = WXAPIFactory.createWXAPI(context, appId);\n\nWXLaunchMiniProgram.Req req = new WXLaunchMiniProgram.Req();\nreq.userName = \"gh_d43f693ca31f\"; \/\/ \u586b\u5c0f\u7a0b\u5e8f\u539f\u59cbid\nreq.path = path;                  \/\/\/\/\u62c9\u8d77\u5c0f\u7a0b\u5e8f\u9875\u9762\u7684\u53ef\u5e26\u53c2\u8def\u5f84\uff0c\u4e0d\u586b\u9ed8\u8ba4\u62c9\u8d77\u5c0f\u7a0b\u5e8f\u9996\u9875\uff0c\u5bf9\u4e8e\u5c0f\u6e38\u620f\uff0c\u53ef\u4ee5\u53ea\u4f20\u5165 query \u90e8\u5206\uff0c\u6765\u5b9e\u73b0\u4f20\u53c2\u6548\u679c\uff0c\u5982\uff1a\u4f20\u5165 \"?foo=bar\"\u3002\nreq.miniprogramType = WXLaunchMiniProgram.Req.MINIPTOGRAM_TYPE_RELEASE;\/\/ \u53ef\u9009\u6253\u5f00 \u5f00\u53d1\u7248\uff0c\u4f53\u9a8c\u7248\u548c\u6b63\u5f0f\u7248\napi.sendReq(req);\n<\/code><\/pre>\n\n\n\n<p><strong>\u56de\u8c03\u8bf4\u660e<\/strong><\/p>\n\n\n\n<p>WXEntryActivity\u4e2d<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>public void onResp(BaseResp resp) {\n    if (resp.getType() == ConstantsAPI.COMMAND_LAUNCH_WX_MINIPROGRAM) {\n        WXLaunchMiniProgram.Resp launchMiniProResp = (WXLaunchMiniProgram.Resp) resp;\n        String extraData =launchMiniProResp.extMsg; \/\/\u5bf9\u5e94\u5c0f\u7a0b\u5e8f\u7ec4\u4ef6 &lt;button open-type=\"launchApp\"&gt; \u4e2d\u7684 app-parameter \u5c5e\u6027\n    }\n}\n<\/code><\/pre>\n\n\n\n<p>\u5c0f\u7a0b\u5e8f\u8df3\u8f6c\u56de\u79fb\u52a8\u5e94\u7528\u8bf7\u53c2\u8003<a href=\"https:\/\/developers.weixin.qq.com\/miniprogram\/dev\/framework\/open-ability\/launchApp.html\" target=\"_blank\" rel=\"noreferrer noopener\">\u300a\u5c0f\u7a0b\u5e8f\u5f00\u53d1\u6587\u6863\u300b<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u8c03\u7528\u63a5\u53e3\uff1aWXLaunchMiniProgram \u79fb\u52a8\u5e94\u7528\u8df3\u8f6c\u5230\u5c0f\u7a0b\u5e8f\u793a\u4f8b\uff1a<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[45],"tags":[6266,6265,2776,6268,2258,2263,6267],"special":[73],"attr":[],"class_list":{"0":"post-13430","1":"post","2":"type-post","3":"status-publish","4":"format-standard","5":"hentry","6":"category-kaifangpingtai","7":"tag-app","10":"tag-wxlaunchminiprogram","11":"tag-2258","12":"tag-2263","13":"tag-6267","14":"special-weixinopen","15":"entry"},"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/www.yimenapp.com\/kb-yimen\/wp-json\/wp\/v2\/posts\/13430","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=13430"}],"version-history":[{"count":1,"href":"https:\/\/www.yimenapp.com\/kb-yimen\/wp-json\/wp\/v2\/posts\/13430\/revisions"}],"predecessor-version":[{"id":13431,"href":"https:\/\/www.yimenapp.com\/kb-yimen\/wp-json\/wp\/v2\/posts\/13430\/revisions\/13431"}],"wp:attachment":[{"href":"https:\/\/www.yimenapp.com\/kb-yimen\/wp-json\/wp\/v2\/media?parent=13430"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.yimenapp.com\/kb-yimen\/wp-json\/wp\/v2\/categories?post=13430"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.yimenapp.com\/kb-yimen\/wp-json\/wp\/v2\/tags?post=13430"},{"taxonomy":"special","embeddable":true,"href":"https:\/\/www.yimenapp.com\/kb-yimen\/wp-json\/wp\/v2\/special?post=13430"},{"taxonomy":"attr","embeddable":true,"href":"https:\/\/www.yimenapp.com\/kb-yimen\/wp-json\/wp\/v2\/attr?post=13430"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}