仅在前台的应用:如何避免“未声明后台位置访问" [英] App only in foreground: How to avoid "Background location access not declared"

查看:88
本文介绍了仅在前台的应用:如何避免“未声明后台位置访问"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的应用仅在前景中时才需要访问该位置.目的是记录用户单击按钮时的gps位置.

my app needs to get access to the location only when it is in foreground. The goal is to record the gps position at moment the user clicks on a button.

该应用正常运行了好几年,但由于未声明背景位置访问权限",apk现在被Play商店拒绝了.我的目的不是在后台使用位置.所以我想有些问题,但是我找不到问题.

The app was working fine for years but the apk is now refused by the play store due to "Background location access not declared" My intent is not to use location in background. So I guess something is wrong but I cannot find the issue.

在清单中,我设置了ACCESS_FINE_LOCATION,但没有设置ACCESS_BACKGROUND_LOCATION我还尝试了< uses-permission android:name =" android.permission.ACCESS_BACKGROUND_LOCATION&qu​​ot;tools:node =删除"/> ,但这无济于事.

In the Manifest, I have set ACCESS_FINE_LOCATION but not ACCESS_BACKGROUND_LOCATION I have also tried <uses-permission android:name="android.permission.ACCESS_BACKGROUND_LOCATION" tools:node="remove" />, but it does not help.

我正在使用LocationManager类在我的活动中:

I am using the LocationManager class In my activity:

  • 在创建"中,我通过调用getSystemService(Context.LOCATION_SERVICE)获得定位服务
  • 在onResume()中,我调用requestLocationUpdates(...)
  • 在onPause()中,我称为removeUpdates(...)

我想念什么?

推荐答案

经过1周的努力,找出了问题所在,向Google支持小组发送了消息(无答案),并在封闭测试中发布了我的代码的不同版本分支机构,再次填写政策表,等等...问题在本周末自行消失(无代码更改).

After 1 week of working hard to find out what the problem was, sending messages to Google support (no answers), releasing different versions of my code in closed testing branches, filling again the policy form, etc... the problem disappeared by itself (no code change) this week-end.

这篇关于仅在前台的应用:如何避免“未声明后台位置访问"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆