简体   繁体   中英

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. I want to know when user approaches each of them and get a callback in background ( didEnterRegion ).

To do this I can initialize beacon regions with this method:

initWithProximityUUID:major:minor:identifier:

and use the startMonitoring method on CoreLocation . The problem is that it can listen to 20 beacon regions max. 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

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. 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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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