set background mode before binding in order to avoid 2nd schedule scan call
@@ -60,6 +60,9 @@ public class RegionBootstrap {
beaconManager = BeaconManager.getInstanceForApplication(context);
beaconConsumer = new InternalBeaconConsumer();
+ if (beaconManager.isBackgroundModeUninitialized()) {
+ beaconManager.setBackgroundMode(true);
+ }
beaconManager.bind(beaconConsumer);
LogManager.d(TAG, "Waiting for BeaconService connection");
}
@@ -82,6 +85,9 @@ public class RegionBootstrap {
beaconManager = BeaconManager.getInstanceForApplication(context);
beaconConsumer = new InternalBeaconConsumer();
+ if (beaconManager.isBackgroundModeUninitialized()) {
+ beaconManager.setBackgroundMode(true);
+ }
beaconManager.bind(beaconConsumer);
LogManager.d(TAG, "Waiting for BeaconService connection");
}
@@ -102,6 +108,9 @@ public class RegionBootstrap {
this.monitorNotifier = application;
beaconManager = BeaconManager.getInstanceForApplication(context);
beaconConsumer = new InternalBeaconConsumer();
+ if (beaconManager.isBackgroundModeUninitialized()) {
+ beaconManager.setBackgroundMode(true);
+ }
beaconManager.bind(beaconConsumer);
LogManager.d(TAG, "Waiting for BeaconService connection");
}
@@ -122,6 +131,9 @@ public class RegionBootstrap {
this.monitorNotifier = application;
beaconManager = BeaconManager.getInstanceForApplication(context);
beaconConsumer = new InternalBeaconConsumer();
+ if (beaconManager.isBackgroundModeUninitialized()) {
+ beaconManager.setBackgroundMode(true);
+ }
beaconManager.bind(beaconConsumer);
LogManager.d(TAG, "Waiting for BeaconService connection");
}
@@ -201,9 +213,6 @@ public class RegionBootstrap {
for (Region region : regions) {
LogManager.d(TAG, "Background region monitoring activated for region %s", region);
beaconManager.startMonitoringBeaconsInRegion(region);
- if (beaconManager.isBackgroundModeUninitialized()) {
- beaconManager.setBackgroundMode(true);
- }
}
} catch (RemoteException e) {
LogManager.e(e, TAG, "Can't set up bootstrap regions");
