Android 8 (Oreo) 中的后台位置限制是什么? [英] What are the background location limits in Android 8 (Oreo)?

查看:52
本文介绍了Android 8 (Oreo) 中的后台位置限制是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

https://developer.android.com/about/versions/奥利奥/背景位置限制

为了降低功耗,Android 8.0(API 级别 26)限制了后台应用检索用户当前位置的频率.应用每小时只能几次接收位置更新.

In an effort to reduce power consumption, Android 8.0 (API level 26) limits how frequently background apps can retrieve the user's current location. Apps can receive location updates only a few times each hour.

文档没有给出任何关于后台位置检索频率限制的细节.

The documentation does not give any specifics about the limits on the frequency of background location retrieval.

假设我在 Android O 设备上运行的应用没有进入前台并且没有接收任何被动位置更新,我可以可靠地期望它接收多少次位置更新?

Assuming my app running on an Android O device does not come into the foreground and does not receive any passive location updates, how many times can I reliably expect it to receive location updates?

只有几次"究竟是多少次?

推荐答案

现在是一个很老的问题,但我最近花了很多时间试图让这样的应用程序工作.我在旧版 Android 上有一个完美的应用,但现在似乎不可能了.

Quite an old question now but I've spent alot of time recently trying to get an app like this to work. I had a perfect app in older Android versions but it now seems impossible.

答案可能会因设备而异,但使用我的 Galaxy S7 设备 (Oreo),我可以随意设置位置,甚至每 5 秒设置一次.但是在闲置 45-60 分钟后,服务会变慢,直到应用再次手动进入前台.

The answer will probably vary depending on devices but with my Galaxy S7 units (Oreo) I can set the location going as often as I want to, even every 5 seconds. But afer 45-60 minutes of idle, the service will just slow down, until the app is brought into the forground manually again.

我已经尝试使用带有唤醒锁和setAndAllowWhileIdle()"的 Job Scheduler、Worker、AlarmManager、AlarmManager,它们都给出了相同的结果:完全活跃的位置更改了 45 分钟左右,而不是每 15 分钟一次或所以(如果你很幸运:可能需要一个多小时,而且似乎不可预测)

I have tried Job Scheduler, Worker, AlarmManager, AlarmManager with Wake Lock and with 'setAndAllowWhileIdle()', and they all give the same results: fully active location changes for 45 minutes or so, than only once every 15 minutes or so (if you're lucky: it can be more than an hour and seems unpredictable)

这篇关于Android 8 (Oreo) 中的后台位置限制是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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