private List<Region> matchingRegions(IBeacon iBeacon, Collection<Region> regions) { List<Region> matched = new ArrayList<Region>(); Iterator<Region> regionIterator = regions.iterator(); while (regionIterator.hasNext()) { Region region = regionIterator.next(); if (region.matchesIBeacon(iBeacon)) { matched.add(region); } else { Log.d(TAG, "This region does not match: " + region); } } return matched; }
private JSONObject mapOfBeaconRegion(Region region) throws JSONException { JSONObject dict = new JSONObject(); // identifier if (region.getUniqueId() != null) { dict.put("identifier", region.getUniqueId()); } dict.put("uuid", region.getProximityUuid()); if (region.getMajor() != null) { dict.put("major", region.getMajor()); } if (region.getMinor() != null) { dict.put("minor", region.getMinor()); } dict.put("typeName", "BeaconRegion"); return dict; }