0

I see this question Estimote: detecting multiple beacons with ESTBeaconRegion and startRangingBeaconsInRegion?

I try that answer provided but when I made three regions (eg: from that sample code beacon1Region, beacon2Region, beacon3Region) and include that "EstimoteSampleRegion" for each (eg: EstimoteSampleRegion1, EstimoteSampleRegion2, EstimoteSampleRegion3) I can only get first beacon as result (in index 0) when I startRangingBeaconsInRegion.

How can I make this to work? should I list that three estimote sample regions in one array that is all for a single region (eg: "beaconRegion") and then look in that single region for the three beacons with [self.beaconManager startRangingBeaconsInRegion:beaconRegion]?
If yes, what is code that show declare that array with many beacons for one region?

Or should I make three beaconManager Instances and each beacons has its own region? Problem when I do this is I can only see first beacon. not three.

Community
  • 1
  • 1
Taku
  • 1
  • 2

1 Answers1

3

The reason why you get only first beacon is because you are ranging different regions and this is how iOS recognizes what are you looking for. Even using CoreLocation and one CLLocationManager you will get one beacon in array in delegate method.

You can add ranged beacon to your own array, which can be property in your model, for example.

Or should I make three beaconManager Instances and each beacons has its own region? Problem when I do this is I can only see first beacon. not three.

Yes, this can be done this way. You then implement

- (void)beaconManager:(ESTBeaconManager *)manager didRangeBeacons:(NSArray *)beacons inRegion:(ESTBeaconRegion *)region

and that method will be called one time for every beacon manager every 1 second. In current beacons array there will be only one object but after all you get all of your beacons. And the same as above, you can add ranged beacon to your own array, which can be property in your model, for example.

If your beacons have the same major number (and different minor numbers) you can the use this method:

[self.manager startRangingBeaconsInRegion:[[ESTBeaconRegion alloc] initWithProximityUUID:ESTIMOTE_PROXIMITY_UUID major:713 identifier:@"Multiple Beacons"]];

after that in

- (void)beaconManager:(ESTBeaconManager *)manager didRangeBeacons:(NSArray *)beacons inRegion:(ESTBeaconRegion *)region

you will get array with more than one beacon inside (of course if you have them near you iOS device).

lvp
  • 2,078
  • 18
  • 24
  • thankyou for information that one beacon in array is correct. So I use - (void)beaconManager but this only give that one result in beacons array. And I cannot make 3 of - (void)beaconManager. how is code to make new combined array from three different managers. – Taku Mar 12 '14 at 12:36
  • For every beacon manager you are creating set your model as delegate `self.beaconManager.delegate = self` – lvp Mar 12 '14 at 13:16
  • oh so I see three beacon in array now. thankyou. question1- should I make one beacon manager instance for each beacon or should all beacons use the same beacon manager. question2 - should each beacon have its own region or just use that one identifier:@"Multiple Beacons" – Taku Mar 12 '14 at 23:28
  • Question 1 and 2 are connected, the simple answer is: if you are looking for multiple beacons with the same major number use one beacon manager(one region). If you are looking for multiple beacons with different major/minor numbers I suggest using multiple beacons managers with different regions. – lvp Mar 13 '14 at 05:56
  • @ivp how cna i get all beacons UUID,minor and major value.which is in my range. – Rushabh Jul 01 '14 at 06:16