【问题标题】:Flutter background location accessFlutter 后台定位访问
【发布时间】:2021-01-16 20:53:38
【问题描述】:

当我在 Google Play 上更新我的应用时,我看到了一条关于我以前从未见过的名为“敏感应用权限”的警告。它似乎涉及到通话、短信、位置和文件访问权限。

Google Play Policy center / Permissions

Google Play 上的权限声明表

位置权限

未开始       您的应用不合规

我的应用使用Flutter Location pluginFlutter Map plugin。我在清单中请求INTERNETACCESS_FINE_LOCATION 权限:

    <uses-permission android:name="android.permission.INTERNET"/>
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />

进一步阅读 Requesting access to location in the background 提供有关 Google Play 政策即将发生变化的更多信息:

审核和批准变更的时间表

从 2020 年 9 月 30 日开始,我们将开始审核请求在后台获取位置信息的应用。如果您的应用受到影响,您将在 Play 管理中心的应用内容页面(政策 > 应用内容)上收到通知以完成权限声明表。

从 2021 年 1 月 18 日开始,所有提交到 Google Play 且在后台访问位置的新应用(2020 年 4 月 16 日之后首次发布)都需要获得批准才能上线。

从 2021 年 3 月 29 日开始,所有在后台访问位置信息的现有应用(2020 年 4 月 16 日之前首次发布)都需要获得批准,否则它们将从 Google Play 中删除。

那么,即使我没有为后台位置请求任何权限,或者在我的应用中主动执行任何操作来访问它,我是否应该担心后台位置的使用?

我在运行 Android 7 的旧手机的状态栏中看到位置图标(地图针),即使应用程序在后台运行也是如此。我还在 Android 7 上看到了偶尔的“后台电池使用率高”。但在 Android 9 和 10 上我没有看到这种情况。

当应用程序“后台”时,我可能草率地停止定位插件 - 但是,我没有请求任何后台定位权限,所以定位插件真的可以在后台收集定位数据 - 从而违反Google Play 政策 - 没有它?

【问题讨论】:

标签: android flutter google-play android-permissions android-location


【解决方案1】:

我将此添加到应用清单中

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
    package="com.example.localstore">
 <uses-permission android:name="android.permission.ACCESS_BACKGROUND_LOCATION" tools:node="remove"/>

source

【讨论】:

  • 这行得通吗?我收到此错误Execution failed for task ':app:processReleaseMainManifest'. &gt; com.android.manifmerger.ManifestMerger2$MergeFailureException: org.xml.sax.SAXParseException; lineNumber: 45; columnNumber: 104; The prefix "tools" for attribute "tools:node" associated with an element type "uses-permission" is not bound.
【解决方案2】:

我认为重要的是您需要将 compileSdkVersiontargetSdkVersion 增加到 29

【讨论】:

  • 我在 Google Play 中使用我的 Flutter 应用程序收到了相同的警告,同样使用 Flutter 位置插件,并且没有请求或使用任何后台位置。我的 compileSdkVersion 和 targetSdkVersion 是 29,所以这似乎没有任何改变......
  • 同样的情况。
  • 我明白了。同样的问题。即使我们在最新版本中删除了位置权限,但在 Play 商店更新应用时仍然显示此错误
猜你喜欢
  • 2021-04-22
  • 1970-01-01
  • 2022-01-19
  • 1970-01-01
  • 2020-06-24
  • 2022-07-13
  • 1970-01-01
  • 1970-01-01
  • 2020-08-21
相关资源
最近更新 更多