降低didEnterRegion的阈值 [英] Reducing the threshold of didEnterRegion

查看:100
本文介绍了降低didEnterRegion的阈值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在开发一个应用程序,我希望我的应用程序能够在它接近(立即)时在后台模式下检测到信标.根据我读过的文章,它不能使用didEnterRegion来完成,并且当它在后台模式(位置更新)中运行时,我应该使用range.有没有直接降低didEnterRegion阈值的解决方案?还是我应该使用其他方法?如果是这样,它是否可以像didEnterRegion一样工作,但RSSI范围有限?我的手机进入该区域并且被锁定并且屏幕关闭时,它能正常工作吗?

I'm currently working on an app that I want for my app to detect a beacon in background mode just when it gets close to it(Immediate). Based on articles that I've read it cannot be done with didEnterRegion and I should use ranging while it's running in the background mode(Location Update). is there any solution that directly reduces the didEnterRegion threshold? or Should I use the other method? and if that's the case does it work like didEnterRegion but with a limited range of RSSI? does it work when my phone entered the region and it's locked and the screen is off?

推荐答案

监视API不能控制您获取检测回调的距离.当信标第一次进入无线电范围(通常在40米左右)时,您总是会收到回调.

Monitoring APIs give you no control over the distance at which you get detection callbacks. You always get a callback the first time a beacon goes within radio range, typically at around 40 meters.

有两种方法仅在近距离触发信标:

There are two ways to trigger on beacons only at close range:

  1. 如果制造商支持,请在信标上配置较低的无线电传输功率.

  1. Configure a lower radio transmission power on your beacon, if the manufacturer supports it.

具有监控功能的组合测距API,并在后台尽可能长时间地进行测距(在没有特殊背景权限的情况下,iOS上最长为180秒),然后在测距回调说CLBeacon精度字段为立即数时触发您的逻辑.

Combine Ranging APIs with Monitoring, and range for as long as possible in the background (180 secs max on iOS without special background permissions), then trigger your logic when a ranging callback says the CLBeacon accuracy field is immediate.

选项1更简单,但可靠性更低,因为它通常会在比您想要的距离更远的距离处触发,有时甚至在极近距离处也难以触发.

Option 1 is simpler, but less reliable as it will often trigger at greater distances than you'd like and sometimes has trouble triggering at all even at extremely close range.

选项2更可靠,只要背景测距时间不会用完即可.如果电话的无线电在40米处触发以开始测距,如果用户花费了超过180秒的时间立即接近,则测距时间用完了,直到信标消失并重新出现以重置允许的测距时间,您才能获得触发

Option 2 is more reliable, so long as background ranging time does not run out. If a phone's radio triggers at 40 meters to start ranging, if the user takes more than 180 secs to get to immediate proximity then ranging time runs out and you are unable to get a trigger until the beacon disappears and reappears to reset the ranging time allowed.

这篇关于降低didEnterRegion的阈值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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