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);
   }
 }
Beispiel #2
0
 /**
  * Method that returns the current {@link ProximityData} object informations as a the
  * corresponding {@link POI} object
  *
  * @return
  */
 public POI asPOI() {
   POI ret = new POI();
   String UUID =
       this.BLERegion.getId1()
           + (BLERegion.getId1() == null ? "" : ":" + BLERegion.getId1())
           + (BLERegion.getId2() == null ? "" : ":" + BLERegion.getId2());
   ret.setBeaconUuid(UUID);
   ret.setName(ID);
   ret.setLatitude(latitude);
   ret.setLongitude(longitude);
   ret.setRadius(radius);
   return ret;
 }
  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;
    }
  }