-1

My Problem

I need to make the combined call for all the region on didRangeBeaconsInRegion right now for each uuid eg: if i have 2 uuid the didRangeBeaconsInRegion is called 2 times and for 4 uuid didRangeBeaconsInRegion called 4 times likewise it goes on. I want didRangeBeaconsInRegion to be called once for all the uuid that i set on region

My Code:

 for (beaconparser.Beacon beacon : iBeacon.getBeacons()) {
      try {
           Identifier uuid = Identifier.parse(iBeacon.getUUID());
           Identifier major = Identifier.parse("" + iBeacon.getMajor());
           Identifier minor = Identifier.parse("" + iBeacon.getMinor());
           beaconManager.startRangingBeaconsInRegion(new Region(iBeacon.getUUID() + major + minor, uuid, null, null));
           setMonitoring(false);
      } catch (RemoteException e) {
           e.printStackTrace();
      }
 }
denvercoder9
  • 2,979
  • 3
  • 28
  • 41
prasanthMurugan
  • 597
  • 6
  • 21

1 Answers1

0

Sorry, the API just does not work like that. The easiest solution is to set up a wildcard Region that sets all identifiers to null. This will give you one callback for all beacons.

You can the use if statements to compare the beacon identifiers to ones you care about and only process them if they match one of your regions.

davidgyoung
  • 63,876
  • 14
  • 121
  • 204