{"id":5721,"date":"2023-09-25T15:30:53","date_gmt":"2023-09-25T07:30:53","guid":{"rendered":"https:\/\/www.yimenyun.cn\/emen\/?p=5721"},"modified":"2023-09-25T15:30:53","modified_gmt":"2023-09-25T07:30:53","slug":"%e7%bd%91%e9%a1%b5%e6%89%93%e5%8c%85%e6%88%90appapk%e6%9c%89%e4%bb%80%e4%b9%88%e5%a5%bd%e5%a4%84%ef%bc%9f","status":"publish","type":"post","link":"https:\/\/www.yimenyun.cn\/emen\/5721\/","title":{"rendered":"\u7f51\u9875\u6253\u5305\u6210appapk\u6709\u4ec0\u4e48\u597d\u5904\uff1f"},"content":{"rendered":"

\u7f51\u9875\u6253\u5305\u6210App\uff08APK\uff09\u662f\u4e00\u79cd\u5c06\u4e00\u4e2a\u6216\u591a\u4e2a\u7f51\u9875\u5185\u5bb9\u8f6c\u5316\u4e3a\u4e00\u4e2a\u72ec\u7acb\u7684Android\u5e94\u7528\u7a0b\u5e8f\u7684\u8fc7\u7a0b\u3002\u8fd9\u6837\u7684\u5e94\u7528\u7a0b\u5e8f\u4e5f\u88ab\u79f0\u4e3a\u201cWebApp\u201d\u6216\u201cPphp\u505aapp<\/a>rogressive Web App\uff08PWA\uff09\u201d\uff0c\u5b83\u53ef\u4ee5\u8ba9\u7528\u6237\u5728\u4e0d\u6253\u5f00\u6d4f\u89c8\u5668\u7684\u60c5\u51b5\u4e0b\uff0c\u901a\u8fc7\u4e00\u4e2a\u72ec\u7acb\u7684\u5e94\u7528\u7a0b\u5e8f\u56fe\u6807\u8fdb\u5165\u7279\u5b9a\u7684\u7f51\u9875\u3002\u540c\u65f6\uff0c\u7531\u4e8e\u4f7f\u7528\u4e86\u539f\u751f\u5e94\u7528\u7a0b\u5e8f\u7684\u5c01\u88c5\uff0c\u53ef\u4ee5\u83b7\u5f97\u66f4\u597d\u7684\u7cfb\u7edf\u517c\u5bb9\u6027\u548c\u6027\u80fd\u4f18\u5316\u3002\u672c\u6587\u5c06\u4ece\u539f\u7406\u548c\u64cd\u4f5c\u65b9\u6cd5\u4e24\u65b9\u9762\u4e3a\u5927\u5bb6\u4ecb\u7ecd\u5982\u4f55\u5c06\u7f51\u9875\u6253\u5305\u6210App\uff08APK\uff09\u3002<\/p>\n

\u4e00\u3001\u5c06\u7f51\u9875\u6253\u5305\u6210App\u7684\u539f\u7406<\/p>\n

\u5c06\u7f51\u9875\u6253\u5305\u6210App\u7684\u5173\u952e\u6280\u672f\u662f\u91c7\u7528WebView\u63a7\u4ef6\u6765\u52a0\u8f7d\u7f51\u9875\u3002WebView\u662fAndroid\u5e73\u53f0\u4e0a\u7684\u4e00\u4e2a\u5185\u5d4c\u6d4f\u89c8\u5668\u63a7\u4ef6\uff0c\u901a\u8fc7\u5b83\uff0c\u53ef\u4ee5\u5728\u5e94\u7528\u7a0b\u5e8f\u4e2d\u76f4\u63a5\u5c55\u793a\u7f51\u9875\u5185\u5bb9\u3002WebView\u63d0\u4f9b\u4e86\u4e0eJS\u8fdb\u884c\u4ea4\u4e92\u7684\u529f\u80fd\uff0c\u8fd9\u610f\u5473\u7740\u53ef\u4ee5\u5b9e\u73b0\u7f51\u9875\u4e0eApp\u4e4b\u95f4\u7684\u53cc\u5411\u6570\u636e\u4ea4\u4e92\u3002\u540c\u65f6\uff0cWebView\u8fd8\u652f\u6301\u901a\u8fc7\u5b89\u5353API\u5b9e\u73b0\u4e00\u4e9b\u672c\u5730\u529f\u80fd\uff0c\u4f8b\u5982\u8bbf\u95ee\u76f8\u673a\u3001GPS\u7b49\u3002<\/p>\n

\u5f53\u6211\u4eec\u5c06\u7f51\u9875\u6253\u5305\u4e3aApp\u65f6\uff0cWebView\u63a7\u4ef6\u5c06\u4f5c\u4e3a\u5e94\u7528\u7a0b\u5e8f\u7684\u4e3b\u8981\u7ec4\u4ef6\uff0c\u5b9e\u73b0\u5bf9\u7f51\u9875\u5185\u5bb9\u7684\u52a0\u8f7d\u548c\u6e32\u67d3\u3002\u4e0b\u9762\u662f\u5229\u7528WebView\u5b9e\u73b0\u7f51\u9875\u6253\u5305\u7684\u57fa\u672c\u6b65\u9aa4\uff1a<\/p>\n

1. \u521b\u5efa\u4e00\u4e2aAndroid Studio\u9879\u76ee\uff0c\u5e76\u6dfb\u52a0WebView\u63a7\u4ef6\u5230\u5e03\u5c40\u6587\u4ef6\u4e2d\u3002<\/p>\n

2. \u5728\u5bf9\u5e94\u7684Java\u4ee3\u7801\u4e2d\uff0c\u521b\u5efa\u4e00\u4e2aWebView\u5b9e\u4f8b\uff0c\u5e76\u5bf9\u5176\u8fdb\u884c\u914d\u7f6e\u3002\u5e38\u89c1\u7684\u914d\u7f6e\u9009\u9879\u6709\uff1a\u542f\u7528JavaScript\u3001\u8bbe\u7f6e\u7f29\u653e\u6bd4\u4f8b\u3001\u8bbe\u7f6e\u7f13\u5b58\u6a21\u5f0f\u7b49\u3002<\/p>\n

3. \u8bbe\u7f6eWebView\u7684\u76d1\u542c\u5668\uff0c\u4f8b\u5982\u76d1\u542c\u9875\u9762\u52a0\u8f7d\u8fdb\u5ea6\u3001\u5904\u7406\u52a0\u8f7d\u9519\u8bef\u7b49\u4e8b\u4ef6\u3002<\/p>\n

4. \u521b\u5efaWeb\u89c6\u56fe\u5ba2\u6237\u7aef\u7c7b\u5e76\u91cd\u5199onPageFinished\u65b9\u6cd5\uff0c\u5f53WebView\u52a0\u8f7d\u5b8c\u6bd5\u540e\uff0c\u8fd0\u884cApp\u5185\u7684JavaScript\u4ee3\u7801\u3002<\/p>\n

5. \u914d\u7f6eApp\u7684\u542f\u52a8\u4fe1\u606f\uff0c\u4f8b\u5982\u8bbe\u7f6e\u7f51\u7edc\u6743\u9650\u3001\u4fee\u6539\u56fe\u6807\u3001\u8bbe\u7f6e\u5c4f\u5e55\u65b9\u5411\u7b49\u3002<\/p>\n

\u7ecf\u8fc7\u4e0a\u8ff0\u6b65\u9aa4\uff0c\u4e00\u4e2a\u5c06\u7f51\u9875\u6253\u5305\u6210App\u7684\u57fa\u672c\u6846\u67b6\u5c31\u5efa\u7acb\u8d77\u6765\u4e86\u3002\u63a5\u4e0b\u6765\uff0c\u53ef\u4ee5\u6839\u636e\u5b9e\u9645\u9700\u6c42\u5728<\/p>\n

<\/figure>\n<\/p>\n

App\u4e2d\u5b9e\u73b0\u66f4\u591a\u5b9a\u5236\u5316\u529f\u80fd\uff0c\u4f8b\u5982\u6dfb\u52a0\u539f\u751f\u83dc\u5355\u3001\u6309\u94ae\u7b49\u3002<\/p>\n

\u4e8c\u3001\u5c06\u7f51\u9875\u6253\u5305\u6210App\u7684\u64cd\u4f5c\u65b9\u6cd5<\/p>\n

\u5c06\u7f51\u9875\u6253\u5305\u6210App\u53ef\u4ee5\u901a\u8fc7\u624b\u52a8\u7f16\u7a0b\u6216\u4f7f\u7528\u73b0\u6709\u7684\u5728\u7ebf\u5de5\u5177\u6765\u5b9e\u73b0\u3002\u4e0b\u9762\u5206\u522b\u4ecb\u7ecd\u8fd9\u4e24\u79cd\u65b9\u6cd5\u7684\u64cd\u4f5c\u6d41\u7a0b\u3002<\/p>\n

1. \u624b\u52a8\u7f16\u7a0b\u5b9e\u73b0<\/p>\n

\u9996\u5148\uff0c\u4f60\u9700\u8981\u719f\u6089Android\u5f00\u53d1\u73af\u5883\uff08Android Studio\uff09\u548c\u76f8\u5173\u7f16\u7a0b\u8bed\u8a00\uff08Java\u6216Kotlin\uff09\u3002\u7136\u540e\uff0c\u4f9d\u7167\u524d\u6587\u6240\u8ff0\u7684\u539f\u7406\uff0c\u521b\u5efa\u4e00\u4e2a\u65b0\u7684Android\u9879\u76ee\uff0c\u5c06WebView\u63a7\u4ef6\u6dfb\u52a0\u5230\u5e03\u5c40\u6587\u4ef6\u4e2d\uff0c\u914d\u7f6eapp\u5f00\u53d1h5<\/a>WebView\u7684\u5404\u9879\u53c2\u6570\uff0c\u521b\u5efaWeb\u89c6\u56fe\u5ba2\u6237\u7aef\u7c7b\uff0c\u8bbe\u7f6e\u76d1\u542c\u9875\u9762\u52a0\u8f7d\u4e8b\u4ef6\u7b49\u3002\u6700\u540e\uff0c\u6253\u5305\u751f\u6210APK\u6587\u4ef6\uff0c\u5b8c\u6210\u7f51\u9875\u8f6cApp\u7684\u8fc7\u7a0b\u3002<\/p>\n

2. \u4f7f\u7528\u5728\u7ebf\u5de5\u5177\u5b9e\u73b0<\/p>\n

\u76ee\u524d\uff0c\u5e02\u573a\u4e0a\u6709\u5f88\u591a\u5728\u7ebf\u5de5\u5177\u53ef\u4ee5\u76f4\u63a5\u5c06\u7f51\u9875\u8f6c\u4e3aApp\uff0c\u5982GoNative\u3001Thunkable\u7b49\u3002\u8fd9\u4e9b\u5de5\u5177\u5bf9\u5927\u90e8\u5206\u624b\u52a8\u7f16\u7a0b\u5b9e\u73b0\u7684\u6b65\u9aa4\u8fdb\u884c\u4e86\u5c01\u88c5\uff0c\u7528\u6237\u4ec5\u9700\u63d0\u4f9b\u76f8\u5173\u4fe1\u606f\uff08\u5982\u7f51\u5740\u3001\u56fe\u6807\u7b49\uff09\uff0c\u5c31\u53ef\u4ee5\u4e00\u952e\u751f\u6210APK\u6587\u4ef6\u3002\u5c3d\u7ba1\u4f7f\u7528\u5728\u7ebf\u5de5\u5177\u7684\u8fc7\u7a0b\u6bd4\u8f83\u7b80\u5355\uff0c\u4f46\u53ef\u80fd\u4f1a\u9047\u5230\u4e00\u4e9b\u529f\u80fd\u9650\u5236\u548c\u7248\u6743\u95ee\u9898\uff0c\u6240\u4ee5\u8bf7\u8c28\u614e\u9009\u62e9\u3002<\/p>\n

\u603b\u7ed3\uff1a<\/p>\n

\u5c06\u7f51\u9875\u6253\u5305\u6210App\u7684\u8fc7\u7a0b\u867d\u7b80\u5355\uff0c\u4f46\u6d89\u53ca\u7684\u6280\u672f\u7ec6\u8282\u8f83\u591a\uff0c\u9700\u8981\u638c\u63e1Android\u5f00\u53d1\u548c\u76f8\u5173\u7f16\u7a0b\u77e5\u8bc6\u3002\u5bf9\u4e8e\u521d\u5b66\u8005\uff0c\u53ef\u4ee5\u5148\u5c1d\u8bd5\u4f7f\u7528\u5728\u7ebf\u5de5\u5177\u7b80\u5355\u8f6c\u6362\u7f51\u9875\u4e3aApp\uff0c\u4ee5\u4e86\u89e3\u5176\u4e2d\u7684\u57fa\u672c\u539f\u7406\u3002\u968f\u7740\u6280\u80fd\u7684\u589e\u957f\uff0c\u53ef\u4ee5\u5c1d\u8bd5\u624b\u52a8\u7f16\u7a0b\u5b9e\u73b0\u66f4\u52a0\u590d\u6742\u7684\u5e94\u7528\u7a0b\u5e8f\u3002\u5e0c\u671b\u672c\u6587\u80fd\u5e2e\u52a9\u4f60\u66f4\u597d\u5730\u7406\u89e3\u7f51\u9875\u6253\u5305\u6210App\u7684\u8fc7\u7a0b\uff0c\u7ed9\u4f60\u5e26\u6765\u601d\u8def\u548c\u542f\u53d1\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"

\u7f51\u9875\u6253\u5305\u6210App\uff08APK\uff09\u662f\u4e00\u79cd\u5c06\u4e00\u4e2a\u6216\u591a\u4e2a\u7f51\u9875\u5185\u5bb9\u8f6c\u5316\u4e3a\u4e00\u4e2a\u72ec\u7acb\u7684Android\u5e94\u7528\u7a0b\u5e8f\u7684\u8fc7\u7a0b\u3002\u8fd9\u6837\u7684\u5e94\u7528\u7a0b\u5e8f\u4e5f\u88ab\u79f0\u4e3a\u201cWebApp\u201d\u6216\u201cProgressive Web App\uff08PWA\uff09\u201d\uff0c\u5b83\u53ef\u4ee5<\/p>\n","protected":false},"author":22,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4],"tags":[10596,10597,12,989,149],"topic":[],"class_list":["post-5721","post","type-post","status-publish","format-standard","hentry","category-appkf","tag-htmlapk","tag-app","tag-12","tag-989","tag-149"],"_links":{"self":[{"href":"https:\/\/www.yimenyun.cn\/emen\/wp-json\/wp\/v2\/posts\/5721","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.yimenyun.cn\/emen\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.yimenyun.cn\/emen\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.yimenyun.cn\/emen\/wp-json\/wp\/v2\/users\/22"}],"replies":[{"embeddable":true,"href":"https:\/\/www.yimenyun.cn\/emen\/wp-json\/wp\/v2\/comments?post=5721"}],"version-history":[{"count":0,"href":"https:\/\/www.yimenyun.cn\/emen\/wp-json\/wp\/v2\/posts\/5721\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.yimenyun.cn\/emen\/wp-json\/wp\/v2\/media?parent=5721"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.yimenyun.cn\/emen\/wp-json\/wp\/v2\/categories?post=5721"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.yimenyun.cn\/emen\/wp-json\/wp\/v2\/tags?post=5721"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.yimenyun.cn\/emen\/wp-json\/wp\/v2\/topic?post=5721"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}