public void handleExitedRegion(org.altbeacon.beacon.Region region) { if (isMonitoringRegion(region)) { String uuid = region.getId1() != null ? region.getId1().toString() : ""; String major = region.getId2() != null ? region.getId2().toString() : ""; String minor = region.getId3() != null ? region.getId3().toString() : ""; this.beaconManager.stopMonitoringRegion(new Region(this.regionName, uuid, major, minor)); this.inRegion = false; callback.whenExited(this.regionName); } }
private boolean isMonitoringRegion(org.altbeacon.beacon.Region region) { if (region != null && currentMonitoredRegion != null) { String id1 = region.getId1() != null ? region.getId1().toString() : ""; String id2 = region.getId2() != null ? region.getId2().toString() : ""; String id3 = region.getId3() != null ? region.getId3().toString() : ""; String currentId1 = currentMonitoredRegion.getId1() != null ? currentMonitoredRegion.getId1().toString() : ""; String currentId2 = currentMonitoredRegion.getId2() != null ? currentMonitoredRegion.getId2().toString() : ""; String currentId3 = currentMonitoredRegion.getId3() != null ? currentMonitoredRegion.getId3().toString() : ""; return (id1.equals(currentId1) && id2.equals(currentId2) && id3.equals(currentId3)); } else { return false; } }