I am new to Android Programming and the Altbeacon Library. I can range the beacon I want, but I need to handle not having the beacon in the area and display a dialog. I can display a dialog without issue, but I can't figure out how to catch a No Beacons Found in Area...help?!?!?
Here's my code (from the altbeacon example with slight modifications)...
public void onBeaconServiceConnect() {
beaconManager.setRangeNotifier(new RangeNotifier() {
@Override
public void didRangeBeaconsInRegion(Collection<Beacon> beacons, Region region) {
if (beacons.size() > 0) {
Beacon firstBeacon = beacons.iterator().next();
Log.i(TAG, "The first beacon I see is about " + beacons.iterator().next().getDistance() + " meters away."}
}
});
try {
Log.d(TAG, "setting up background monitoring for beacons and power saving");
// wake up the app when a beacon is seen
String uuid = "MYCUSTOM UUID STRING";
beaconManager.startRangingBeaconsInRegion(new Region(uuid, Identifier.parse(uuid), null, null));
}
catch (RemoteException e) { }
}
I think an alternate solution would be to just do monitoring, but I need to get the Major and Minor values....can I do that from a monitoring activity?