gpt4 book ai didi

ios - 背景 iBeacon 区域范围的注意事项

转载 作者:行者123 更新时间:2023-11-29 12:06:20 25 4
gpt4 key购买 nike

苹果 explicitly discourages background iBeacon Ranging :

To promote consistent results in your app, use beacon ranging only while your app is in the foreground.

If your app is in the foreground, it is likely that the device is in the user’s hand and that the device’s view to the target beacon has fewer obstructions.

Running in the foreground also promotes better battery life by processing incoming beacon signals only while the user is actively using the device.

我是否应该选择顽皮地在后台做一些测距(在监控时进入信标范围之后),我应该期待什么后果?(除了之前著名的 10 秒运行窗口又睡着了?

最佳答案

在大多数情况下,没有理由担心随意背景测距会耗尽电池电量。

我以前读过那个声明,但我认为它没有任何意义,并且怀疑它是在 CoreLocation iBeacon 设计完成之前写的。 (该声明自 iOS 7 测试版以来一直存在。)

Apple iOS 通常强制执行您一次只能在后台进行 10 秒的范围,通常由 CLBeaconRegion 监控进入/退出事件触发。除非您的应用处于极端情况下,它一直看到信标区域进入和退出,否则 10 秒的后台蓝牙扫描不会消耗那么多电量。

当然,有些技术可以让您更频繁地测距,例如请求位置背景模式以进行恒定测距,或者请求额外的 3 分钟测距时间,如 my blog post here 中所述。 .如果您使用这些技术之一,您可能应该测试您的应用程序对电池的影响。但我当然不会将做这些事情描述为“顽皮”,只要你负责任地这样做。

关于ios - 背景 iBeacon 区域范围的注意事项,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34853469/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com