iBeacons Multiple Monitoring
Asked Answered
I

3

7

I am developing an application which will have multiple ibeacons to detect and react according. The client has different stores in which he wants to deploy the beacons. I am now in a situation where the ibeacons are very close to each other. All the beacons share the same UUID but different major and minor values.

The situation is this:

A user enters the shop and it receive first notification through beacon monitoring. Now to get the other notification for the other beacon the user has to left the region and enter it again in order for the didEnterRegion to call otherwise the user will not get the alert for the other beacons. And that is not happening in my case. The beacons are close to each other that the user not really leaves the region once it enters it. And the notifications do not come through ranging once the device is locked or the application is killed.

Any suggestions on how to tackle this problem in a real case scenario. How to get the notification for all the beacons on a lock screen. I am using the estimote beacons for development.

Inseverable answered 8/8, 2014 at 9:57 Comment(1)
Check these two: #20124943 #19477544 it seems there are 2 options: First one is that you can setup different regions for each beacon and monitor them separately, which gives you didEnterRegion for each region. But this is limited to 20 regions in iOS. Second one is that you combine monitoring and ranging. Even you get one didEnterRegion, you range all the beacons.Studbook
G
8

This is a common problem. As you have seen, background detection is only triggered by region monitoring, and if your regions are set up to cover multiple beacons in the same physical area, you won't get background notifications as you move between them.

You can only get entry/exit updates in the background for a maximum of 20 BeaconRegions per app. So the common solution is to creatively use these 20 BeaconRegions for maximum results. If you have 20 or fewer different beacons within range of each other, the technique is straightforward -- you simply create one region for each beacon, and monitor on all of these.

If you need to work with > 20 beacons, then you have to come up with a numbering scheme that helps this along. For example, you can set all of the beacons' ProximityUUIDs to the same value, number your major values 1-20, and then set the minor values to a unique number for each beacon. You then would then monitor for the 20 regions, each with a different major number. You would also set up simultaneous ranging so you can also get the minor identifier of detected beacons. Like this:

  CLBeaconRegion *region1 = [[CLBeaconRegion alloc] initWithProximityUUID:uuid identifier:@"region1" major:1 ];
  CLBeaconRegion *region2 = [[CLBeaconRegion alloc] initWithProximityUUID:uuid identifier:@"region2" major:2 ];
  ...
  CLBeaconRegion *region20 = [[CLBeaconRegion alloc] initWithProximityUUID:uuid identifier:@"region20" major:20 ];

  [locationManager startMonitoringBeaconsInRegion:region1];
  [locationManager startRangingBeaconsInRegion:region1];
  [locationManager startMonitoringBeaconsInRegion:region2];
  [locationManager startRangingBeaconsInRegion:region2];
  ...
  [locationManager startMonitoringBeaconsInRegion:region20];
  [locationManager startRangingBeaconsInRegion:region20];

This technique works well if you can ensure that there is never a case where two beacons with the same minor number that would be within radio range of a mobile device simultaneously (e.g. beacons with the same minor must be > 100 meters apart). If you can't do this, then you have to start making compromises.

Grobe answered 8/8, 2014 at 13:54 Comment(4)
If you range all of these beacons, you'll get a ton of repeat calls. I like to range one global region with the UUID, but no major/minor values. In didRange you'll still get updates for any beacon in Range, without repeating calls.Billat
It is true you will get more callbacks with this scheme, but remember it is a computer, so it doesn't really care. I doubt it will have much affect on battery or CPU. That said, you could certainly set up a single Region for ranging that just includes the ProximityUUID. I don't think that really matters.Grobe
So just to follow up on the statement that "..a maximum of 20 BeaconRegions per app...". If you have one app monitoring for regions 1..20, then you could also have a second app monitoring for regions 21..40? I assume if this is the case, there must be a limit?Lotti
This is a bigger question than can be fully answered in comments, but in general, yes, each app gets 20 regions. There is no published overall limit, but there are likely practical hardware and software limits that wold come up if you had dozens or hundreds of apps all taking up their full allotment of regions.Grobe
L
1

Multiple beacons monitoring is not possible. Since iOS has limits, maximum number of supported regions should be 20. We can achieve your use case by doing the followings.

  • Group all the beacons with single UUID. We can monitor one region instead monitoring multiple regions
  • Capture the nearby beacons through ranging(Monitoring will trigger only enter and exit. When the user stays within the region for longer time, then monitoring delegated won't be triggered.) Sort the beacons with proximity received through didRange method.

If no beacons found with "Immediate" Proximity, move to next proximity Near. Display notification if we found any one beacon with proximity Immediate. If more than one beacons are found with immediate proximity, then sort using RSSI. Lowest RSSI will be the closest beacon and display the notification for the closest one.

If no beacons found with "Near" Proximity, move to next proximity Far. Display notification if we found any one beacon with proximity Near. If more than one beacons are found with near proximity, then sort using RSSI. Lowest RSSI will be the nearest beacon and display the notification for the nearest one.

If no beacons found with "Far" Proximity, then you don't have any beacons nearby. Display notification if we found any one beacon with proximity Far. If more than one beacons are found with Far proximity, then sort using RSSI. Lowest RSSI will be the nearest beacon and display the notification for the nearest one.

Unknown - You can ignore this

Loewi answered 5/4, 2018 at 8:40 Comment(0)
S
0

You can approach this problem and solve it way easier. Stop triggering the notification when the users exit the region. Use instead the proximity function which will give you more flexibility: use CLProximity. You can choose between immediate, close, far etc. So based on the minor of the beacons and its proximity you can trigger the notifications you want.

Scrubber answered 1/3, 2017 at 13:54 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.