{"id":1821,"date":"2022-11-25T18:00:26","date_gmt":"2022-11-25T10:00:26","guid":{"rendered":"https:\/\/app.applebyme.cn\/cloud\/appshangjia\/1821.html"},"modified":"2022-11-25T18:00:26","modified_gmt":"2022-11-25T10:00:26","slug":"%e5%b0%8f%e7%b1%b3%e5%85%b3%e4%ba%8e%e8%b0%83%e6%95%b4%e8%8e%b7%e5%8f%96%e5%ba%94%e7%94%a8%e5%88%97%e8%a1%a8%e6%9d%83%e9%99%90%e6%96%b0%e5%a2%9e%e8%b0%83%e8%8a%82","status":"publish","type":"post","link":"https:\/\/app.applebyme.cn\/cloud\/appshangjia\/1821.html","title":{"rendered":"\u5c0f\u7c73\u5173\u4e8e\u8c03\u6574\u201c\u83b7\u53d6\u5e94\u7528\u5217\u8868\u201d\u6743\u9650&#038;\u65b0\u589e\u201c\u8c03\u8282\u5a92\u4f53\u97f3\u91cf\u201d\u6743\u9650\u7684\u9002\u914d\u8bf4\u660e"},"content":{"rendered":"<p>\u5c0f\u7c73\u5173\u4e8e\u8c03\u6574\u201c\u83b7\u53d6\u5e94\u7528\u5217\u8868\u201d<span class=\"wpcom_tag_link\">\u6743\u9650<\/span>&amp;\u65b0\u589e\u201c\u8c03\u8282\u5a92\u4f53\u97f3\u91cf\u201d\u6743\u9650\u7684\u9002\u914d\u8bf4\u660e<\/p>\n<h2 id=\"_0\">1\u3001\u83b7\u53d6\u5e94\u7528\u5217\u8868\u6743\u9650\u7b80\u4ecb<\/h2>\n<p>\u201c\u83b7\u53d6\u5e94\u7528\u5217\u8868\u201d\u6743\u9650\u662f\u5728<span class=\"wpcom_tag_link\">Android<\/span>\u539f\u751f QUERY_ALL_PACKAGES \u6743\u9650\u57fa\u7840\u4e0a\u989d\u5916\u7684\u6743\u9650\u7ba1\u7406\u3002<\/p>\n<p>\u5f71\u54cd PackageManager#getInstalledPackages\u548cPackageManager#getInstalledApplications \u4e24\u4e2a\u63a5\u53e3\u8fd4\u56de\u503c\u3002<\/p>\n<p>\u5e94\u7528\u6ca1\u9002\u914d\u7684\u60c5\u51b5\u4e0b\uff0c\u9ed8\u8ba4\u6dfb\u52a0\u6743\u9650\u72b6\u662f\u201c\u4ec5\u5728\u4f7f\u7528\u4e2d\u5141\u8bb8\u201d\uff08\u5e94\u7528\u4e0d\u58f0\u660e\u4e5f\u4f1a\u6dfb\u52a0\uff09\uff0c\u5373\u5e94\u7528\u5728\u524d\u53f0\u65f6\u53ef\u4ee5\u6b63\u5e38\u83b7\u53d6\u3002\u4e5f\u53ef\u4ee5\u6309\u7167\u4e0b\u9762\u65b9\u6cd5\u9002\u914d\u52a8\u6001\u7533\u8bf7\u3002<\/p>\n<h2 id=\"_1\">1.1.\u9002\u914d\u65b9\u6cd5<\/h2>\n<p>\u6e05\u5355\u6587\u4ef6\u58f0\u660e<\/p>\n<pre class=\"wp-block-code\"><code>&lt;uses-permission android:name=\"com.android.permission.GET_INSTALLED_APPS\"\/&gt;<\/code><\/pre>\n<p>\u5224\u65adMIUI \u662f\u5426\u652f\u6301\u52a8\u6001\u7533\u8bf7\u6743\u9650<\/p>\n<pre class=\"wp-block-code\"><code><strong>try<\/strong> {\n    PermissionInfo permissionInfo =  getApplicationContext().getPackageManager().getPermissionInfo(\"com.android.permission.GET_INSTALLED_APPS\", 0);\n    <strong>if<\/strong> (permissionInfo != <strong>null<\/strong> &amp;&amp; permissionInfo.packageName.equals(\"com.lbe.security.miui\")) {<em>\/\/MIUI \u7cfb\u7edf\u652f\u6301\u52a8\u6001\u7533\u8bf7\u8be5\u6743\u9650<\/em>\n        <strong>if<\/strong> (ContextCompat.checkSelfPermission(getApplicationContext(), \"com.android.permission.GET_INSTALLED_APPS\") != PackageManager.PERMISSION_GRANTED) {\n            <em>\/\/\u6ca1\u6709\u6743\u9650\uff0c\u9700\u8981\u7533\u8bf7<\/em>\n            ActivityCompat.requestPermissions(MainActivity.<strong>this<\/strong>, <strong>new<\/strong> String&#091;]{\"com.android.permission.GET_INSTALLED_APPS\"}, 999);\n        }\n    }\n} <strong>catch<\/strong> (PackageManager.NameNotFoundException e) {\n    e.printStackTrace();\n}<\/code><\/pre>\n<p>\u63d0\u793a\uff1a\u5982\u679c\u7cfb\u7edf\u4fa7\u4e0d\u652f\u6301\u6b64\u6743\u9650\uff0c\u5e94\u7528\u4ecd\u7136\u4f1a\u4fdd\u6301\u9ed8\u8ba4\uff08\u4ec5\u5728\u4f7f\u7528\u4e2d\u5141\u8bb8\uff09\u3002<\/p>\n<p>\u5224\u65ad\u6743\u9650\u6388\u4e88\u7ed3\u679c\uff08\u4e0e\u666e\u901a\u8fd0\u884c\u65f6\u6743\u9650\u6ca1\u6709\u533a\u522b\uff09<\/p>\n<pre class=\"wp-block-code\"><code><strong>public<\/strong> <strong>void<\/strong> <strong>onRequestPermissionsResult<\/strong>(<strong>int<\/strong> requestCode, @NonNull String&#091;] permissions, @NonNull <strong>int<\/strong>&#091;] grantResults) {\n    <strong>super<\/strong>.onRequestPermissionsResult(requestCode, permissions, grantResults);\n    <em>\/\/ do something<\/em>\n}<\/code><\/pre>\n<h2 id=\"_2\">1.2.\u7279\u6b8a\u8bf4\u660e\uff1a<\/h2>\n<p>\u5982\u679c\u4e0d\u9700\u8981\u7cfb\u7edf\u6dfb\u52a0\u83b7\u53d6\u5e94\u7528\u5217\u8868\u7684\u6743\u9650\uff0c\u53ef\u4ee5\u901a\u8fc7\u4e0b\u9762\u4ee3\u7801\u5b9e\u73b0\uff08\u540c\u65f6\uff0c\u6e05\u5355\u6587\u4ef6\u4e2d\u4e0d\u80fd\u7533\u8bf7\u66f4\u6539\u6743\u9650\uff09<\/p>\n<pre class=\"wp-block-code\"><code>&lt;meta-data\n     android:name=\"do_not_need_get_installed_apps\"\n     android:value=\"true\"\/&gt;<\/code><\/pre>\n<p>\u6ce8\u610f\uff1a\u5982\u679c\u58f0\u660e\u6b64meta-data\uff0c\u7b49\u4e8e\u201c\u83b7\u53d6\u5e94\u7528\u5217\u8868\u201d\u6743\u9650\u5173\u95ed\uff01<\/p>\n<h2 id=\"_3\">1.3.MIUI\u751f\u6548\u7248\u672c\uff1a<\/h2>\n<p>MIUI 13<\/p>\n<h2 id=\"_4\">2\u3001\u8c03\u8282\u5a92\u4f53\u97f3\u91cf\u6743\u9650\u8bf4\u660e<\/h2>\n<p>\u4e3a\u51cf\u5c11\u90e8\u5206\u5e94\u7528\u64c5<a href=\"https:\/\/app.applebyme.cn\/shengcheng-41.html\">\u7f51\u7ad9\u751f\u6210App<\/a>\u81ea\u4fee\u6539\u5a92\u4f53\u97f3\u91cf\uff0c\u800c\u4e0d\u4e3b\u52a8\u544a\u77e5\u7528\u6237\u6216\u83b7\u5f97\u7528\u6237\u8bb8\u53ef\u7684\u884c\u4e3a\uff0c\u540c\u65f6\u5c3d\u53ef\u80fd\u907f\u514d\u5bf9\u7528\u6237\u5e26\u6765\u76f8\u5e94\u7684\u56f0\u6270\u3002\u73b0\u5728\u5355\u72ec\u8bbe\u7acb\u201c\u8c03\u8282\u5a92\u4f53\u97f3\u91cf\u201d\u7684\u6743\u9650\uff0c\u5e76\u5c06\u9ed8\u8ba4\u72b6\u6001\u8bbe\u7f6e\u4e3a\u201c\u4ec5\u5728\u4f7f\u7528\u4e2d\u5141\u8bb8\u201d\u3002\u540c\u65f6\uff0c\u201c\u5e94\u7528\u884c\u4e3a\u8bb0\u5f55\u201d\u529f\u80fd\u4e2d\u5c06\u4f1a\u5bf9\u5e94\u7528\u4fee\u6539\u5a92\u4f53\u97f3\u91cf\u7684\u884c\u4e3a\u8fdb\u884c\u8bb0\u5f55\uff0c\u7528\u6237\u53ef\u4e3b\u52a8\u8c03\u6574\u76f8\u5173\u7684\u6743\u9650\u3002\u60a8\u7684\u5e94\u7528\u5982\u6709\u8c03\u8282\u5a92\u4f53\u97f3\u91cf\u7684\u9700\u6c42\uff0c\u53ef\u80fd\u53d7\u5230\u5f71\u54cd\uff0c\u5efa\u8bae\u60a8\u81ea\u884c\u8c03\u6574\u76f8\u5173\u7684\u4ea7\u54c1\u7b56\u7565\u3002<\/p>\n<p>MIUI 11\u53ca\u4ee5\u4e0b\u7248\u672c\u5c06\u4e0d\u53d7\u8be5\u8c03\u6574\u7684\u5f71\u54cd\u3002<\/p>\n<p>                    <a href=\"https:\/\/app.applebyme.cn\/shengcheng-9.html\">app\u751f\u6210\u5668<\/a>                                    <\/p>\n<p>\u7f16\u8f91\uff1ayimen\uff0c\u5982\u82e5\u8f6c\u8f7d\uff0c\u8bf7\u6ce8\u660e\u51fa\u5904\uff1ahttps:\/\/www.yimenapp.com\/kb-yimen\/12538\/<\/p>\n<p>\u90e8\u5206\u5185\u5bb9\u6765\u81ea\u7f51\u7edc\u6295\u7a3f\uff0c\u5982\u6709\u4fb5\u6743\u8054\u7cfb\u7acb\u5220<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5c0f\u7c73\u5173\u4e8e\u8c03\u6574\u201c\u83b7\u53d6\u5e94\u7528\u5217\u8868\u201d\u6743\u9650&amp;\u65b0\u589e\u201c\u8c03\u8282\u5a92\u4f53\u97f3\u91cf\u201d\u6743\u9650\u7684\u9002\u914d\u8bf4\u660e1\u3001\u83b7\u53d6\u5e94\u7528\u5217\u8868\u6743\u9650\u7b80\u4ecb\u201c\u83b7\u53d6\u5e94\u7528\u5217\u8868\u201d\u6743\u9650\u662f\u5728Android\u539f\u751f QUERY_ALL_PACKAGES \u6743\u9650\u57fa\u7840\u4e0a\u989d\u5916\u7684\u6743\u9650\u7ba1\u7406\u3002\u5f71\u54cd PackageManager#getInstalledPackages\u548cPackageMana<\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[14],"tags":[548,847,1278],"class_list":["post-1821","post","type-post","status-publish","format-standard","hentry","category-appshangjia","tag-548","tag-847","tag-1278"],"_links":{"self":[{"href":"https:\/\/app.applebyme.cn\/cloud\/wp-json\/wp\/v2\/posts\/1821","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/app.applebyme.cn\/cloud\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/app.applebyme.cn\/cloud\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/app.applebyme.cn\/cloud\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/app.applebyme.cn\/cloud\/wp-json\/wp\/v2\/comments?post=1821"}],"version-history":[{"count":0,"href":"https:\/\/app.applebyme.cn\/cloud\/wp-json\/wp\/v2\/posts\/1821\/revisions"}],"wp:attachment":[{"href":"https:\/\/app.applebyme.cn\/cloud\/wp-json\/wp\/v2\/media?parent=1821"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/app.applebyme.cn\/cloud\/wp-json\/wp\/v2\/categories?post=1821"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/app.applebyme.cn\/cloud\/wp-json\/wp\/v2\/tags?post=1821"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}