{"id":1294,"date":"2023-03-18T10:24:26","date_gmt":"2023-03-18T02:24:26","guid":{"rendered":"https:\/\/www.appblog.cn\/?p=1294"},"modified":"2023-04-29T09:18:29","modified_gmt":"2023-04-29T01:18:29","slug":"android-10-api-29-new-feature-adaptation-adding-location-restrictions-to-background-applications","status":"publish","type":"post","link":"https:\/\/www.appblog.cn\/index.php\/2023\/03\/18\/android-10-api-29-new-feature-adaptation-adding-location-restrictions-to-background-applications\/","title":{"rendered":"Android 10(Api 29)\u65b0\u7279\u6027\u9002\u914d &#8211; \u540e\u53f0\u5e94\u7528\u589e\u52a0\u5b9a\u4f4d\u9650\u5236"},"content":{"rendered":"<p>\u5b98\u65b9\u6587\u6863\uff1a<a target=\"_blank\" rel=\"noopener\" href=\"https:\/\/developer.android.google.cn\/preview\/privacy\/device-location\">https:\/\/developer.android.google.cn\/preview\/privacy\/device-location<\/a><\/p>\n<h2>\u95ee\u9898\u63cf\u8ff0<\/h2>\n<p>\u540e\u53f0\u5e94\u7528\u8981\u83b7\u53d6\u4f4d\u7f6e\u4fe1\u606f\u9700\u8981\u52a8\u6001\u7533\u8bf7\u6743\u9650<\/p>\n<p><!-- more --><\/p>\n<pre><code class=\"language-xml\">&lt;uses-permission android:name=&quot;android.permission.ACCESS_BACKGROUND_LOCATION&quot;\/&gt;<\/code><\/pre>\n<p>\u5728AndroidQ\u4e0a\u8fd0\u884c\uff1a<\/p>\n<ul>\n<li><code>targetSdkVersion&lt;Q<\/code>\uff0c\u6ca1\u5f71\u54cd\uff0c\u7533\u8bf7\u6743\u9650\u65f6\u7cfb\u7edf\u9ed8\u8ba4\u4f1a\u52a0\u4e0a\u540e\u53f0\u4f4d\u7f6e\u6743\u9650<\/li>\n<li><code>targetSdkVersion&gt;=Q<\/code>\uff0c\u9700\u7533\u8bf7\uff1b<\/li>\n<li>\u5e94\u7528\u53d8\u4e3a\u540e\u53f0\u5e94\u752890s\u540e\u5f00\u59cb\u5b9a\u4f4d\u5931\u8d25\uff08Pixel Android Q\uff09<\/li>\n<li><code>ACCESS_BACKGROUND_LOCATION<\/code>\u4e0d\u80fd\u5355\u72ec\u7533\u8bf7\uff0c\u9700\u8981\u548c<code>ACCESS_COARSE_LOCATION\/ACCESS_FINE_LOCATION<\/code>\u4e00\u8d77\u7533\u8bf7<\/li>\n<\/ul>\n<h2>\u89e3\u51b3\u65b9\u6cd5<\/h2>\n<p>\uff081\uff09\u52a8\u6001\u7533\u8bf7\u5373\u53ef<\/p>\n<p>\uff082\uff09\u542f\u52a8\u524d\u53f0\u670d\u52a1<\/p>\n<pre><code class=\"language-xml\">&lt;!-\u9700\u8981\u8bbe\u7f6eforegroundServiceType\u4e3a\u201clocation\u201d -&gt;\n&lt;service \n  android:name=&quot;.permission.LocationService&quot;\n  android:foregroundServiceType=&quot;location&quot;\n  \/&gt;<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>\u5b98\u65b9\u6587\u6863\uff1ahttps:\/\/developer.android.google.cn\/preview\/privac [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[325],"tags":[],"class_list":["post-1294","post","type-post","status-publish","format-standard","hentry","category-android-adaptation"],"_links":{"self":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/posts\/1294","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/comments?post=1294"}],"version-history":[{"count":0,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/posts\/1294\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/media?parent=1294"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/categories?post=1294"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/tags?post=1294"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}