How can I get multiple beacon id within the range?


I want to get the id of beacon in my android application. So, I use the template of Estimote Monitoring Beacon and I changed three beacon tags to “monitoringexample-8mi”.

However, if I receive one of the multiple beacons tagged with “monitoringexample-8mi”, StartMonitoring() for other beacons is not called until onExit() of that beacon is called.

I think beacon’s tag is a problem. Is there a way to get three beacons id even if one beacon is connected?

Below is the template code that is triggered when the user is within the range of the beacon.


It’s best to think of a Proximity Zone as a group of beacons with the same tag. You only get one onEnter and one onExit per group, not per each beacon in the group.

For the situations where you need to know exactly which specific beacons are in range, we have the onContextChanged callback/event.

Say you have three beacons A, B, C, using the same tag. An example order of events could be:

  • say you enter range of B first, you get onEnter with B’s ID, and onContextChanged with an array* with just one element, beacon B
  • say you then enter range of A; you won’t get a second onEnter, but you will get onContextChanged with an array of two elements, A and B
  • finally, you enter range of C; no onEnter again, but onContextChanged triggers with A, B, and C
  • now you exit range of B; you’re still in range of A and C, so no onExit yet, but onContextChanged triggers with A and C
  • the, you exit range of A; still in range of C, so no onExit, but onContextChanged triggers with A
  • finally, you exit range of A; you’re now completely out of the zone, so onExit triggers, alongside onContextChanged with an empty array

* technically, it’s an unordered set


I’m really thank you for your reply.
I read the guide of onContextChanged function but I forgot that.
So I used that function and I resolved the problem.
But there is one more question about unordered set…
I want to parse the id of beacon in Set<? extends ProximityZoneContext> proximityZoneContexts.
Previously, onEnter and onExit functions were available through getDeviceId function but in onContextChanged function getDeviceId didn’t work because of Set<? extends ProximityZoneContext> .
How can I use this…I’m the begginer.


That’s because Set means it’s a collection of beacons, and getDeviceId works on a single beacon. You could do something like this:

ProximityZoneContext[] contextsArray = 
        proximityZoneContexts.toArray(new ProximityZoneContext[0]);

// now you can do getDeviceId like this:
String beacon1ID = contextsArray[0].getDeviceId();
String beacon2ID = contextsArray[1].getDeviceId();
String beacon3ID = contextsArray[2].getDeviceId();

Wow… It’s really helpful to me.
I will study about Set.
Thank you for your reply!!!