简体   繁体   English

iOS CoreLocation上最大20个信标区域的解决方法

[英]Workaround for 20 maximum beacon regions on iOS CoreLocation

Let's say I have 100 beacons clustered in one location with the same UUID and different majors/minors. 假设我在一个位置聚集了100个信标,它们具有相同的UUID和不同的专业/未成年人。 I want to know when user approaches each of them and get a callback in background ( didEnterRegion ). 我想知道用户何时接近它们,并在后台获取一个回调( didEnterRegion )。

To do this I can initialize beacon regions with this method: 为此,我可以使用以下方法初始化信标区域:

initWithProximityUUID:major:minor:identifier:

and use the startMonitoring method on CoreLocation . 和使用上的CoreLocation方法startMonitoring。 The problem is that it can listen to 20 beacon regions max. 问题在于它最多可以收听20个信标区域。 Is there any way around that ? 有什么办法解决吗?

There are two ways: 有两种方法:

A potential solution is to allocate a unique major value only across overlapping beacons. 潜在的解决方案是仅在重叠的信标之间分配唯一的主要值。 Eg if you have a beacon in an office, assign a different major to each beacon in all nearby offices next door, above and below. 例如,如果您在办公室中有一个信标,请为隔壁的上下左右所有附近办公室中的每个信标分配一个不同的专业。 Then for a beacon that is out of range of this office, you can then reuse the major again. 然后,对于不在此办公室范围内的信标,您可以再次重复使用该专业。 Then you can monitor for UUID + major and hopefully you have less than 20. Use the minor value plus the shared major and make a unique ID for the room, eg 然后,您可以监视UUID +专业,并且希望少于20。使用次要值加上共享专业,并为房间创建唯一的ID,例如

Office 1, major 1, minor 1
Office 2, major 2, minor 1
Office 3, major 1, minor 2

Office 3 is out of range of office 1 so they can use the same major. Office 3不在Office 1的范围内,因此他们可以使用相同的专业。 Hence you will receive a didLeaveRegion notification for office 1 followed by didEnterRegion office 3 because it is not possible to enter 3 without leaving 1. 因此,您将收到办公室1的didLeaveRegion通知,然后是didEnterRegion办公室3的通知,因为不离开1就无法输入3。

Note this is just the theory, has not been tested yet. 注意这只是理论,尚未经过测试。 If you would like me to test it out then just let me know. 如果您希望我进行测试,请告诉我。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM