hello,,
my code cannot differentiate between beacons with different IDs, that means when I put this code, it always detect the green one!
**Here is the definitions of the class:
private static final int NOTIFICATIONID = 123;
private static BeaconManager beaconManager;
private static NotificationManager notificationManager;
public static final String EXTRASBEACON = "extrasBeacon";
private static final String ESTIMOTEPROXIMITYUUID = "B9407F30-F5F8-466E-AFF9-25556B57FE6D";
private static final Region ALL_BEACONS = new Region(ESTIMOTE_PROXIMITY_UUID,
ESTIMOTE_PROXIMITY_UUID, null, null);
private static final Region DARKBLUE_BEACONS = new Region(ESTIMOTE_PROXIMITY_UUID,
ESTIMOTE_PROXIMITY_UUID, 13735, 11554);
private static final Region LIGHTBLUE_BEACONS = new Region(ESTIMOTE_PROXIMITY_UUID,
ESTIMOTE_PROXIMITY_UUID, 40624, 6456);
private static final Region GREEN_BEACONS = new Region(ESTIMOTE_PROXIMITY_UUID,
ESTIMOTE_PROXIMITY_UUID, 28511, 51880);
**Here is the (onEnteredRegion) method:
beaconManager.setMonitoringListener(new MonitoringListener() {
// ... close to us.
@Override
public void onEnteredRegion(Region region, List<Beacon> beacons) {
if (beacons.get(0).getMajor() == DARKBLUE_BEACONS.getMajor() && beacons.get(0).getMinor() == DARKBLUE_BEACONS.getMinor()) { postNotificationIntent("Color: ", "Dark Blue", i);}
else if (beacons.get(0).getMajor() == GREEN_BEACONS.getMajor() && beacons.get(0).getMinor() == GREEN_BEACONS.getMinor()) { postNotificationIntent("Color: ", "Green", i);}
else if (beacons.get(0).getMajor() == LIGHTBLUE_BEACONS.getMajor() && beacons.get(0).getMinor() == LIGHTBLUE_BEACONS.getMinor()) { postNotificationIntent("Color: ", "Light Blue", i);}
}