应用程序可能需要批准后台位置
App may need approval for background location
我收到一封来自 google 的电子邮件,说我的一个应用程序需要将位置权限从后台更改为前台....
我查看了该应用程序,它似乎已经在前台...我对我的清单的权限是:
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.INTERNET" />
我也是按用户需求请求权限...请问是什么问题?
如果你按照link你会发现在什么情况下你需要前台权限。
在link中清楚地写着:
If your app contains a feature that shares or receives location
information only once, or for a defined amount of time, then that
feature requires foreground location access. Some examples include the
following:
- Within a navigation app, a feature allows users to get turn-by-turn directions.
- Within a messaging app, a feature allows users to share their current location with another user.
在 Android 10(API 级别 29)及更高级别,您必须声明此前台服务类型。
<service
android:name="MyNavigationService"
android:foregroundServiceType="location" ... >
<!-- Any inner elements would go here. -->
</service>
我收到一封来自 google 的电子邮件,说我的一个应用程序需要将位置权限从后台更改为前台....
我查看了该应用程序,它似乎已经在前台...我对我的清单的权限是:
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.INTERNET" />
我也是按用户需求请求权限...请问是什么问题?
如果你按照link你会发现在什么情况下你需要前台权限。
在link中清楚地写着:
If your app contains a feature that shares or receives location information only once, or for a defined amount of time, then that feature requires foreground location access. Some examples include the following:
- Within a navigation app, a feature allows users to get turn-by-turn directions.
- Within a messaging app, a feature allows users to share their current location with another user.
在 Android 10(API 级别 29)及更高级别,您必须声明此前台服务类型。
<service
android:name="MyNavigationService"
android:foregroundServiceType="location" ... >
<!-- Any inner elements would go here. -->
</service>