When the application goes to the background, didExitRegion() of MonitorNotifier callback is called automatically.
How can I prevent that automatic call?
@Override
public void **onBeaconServiceConnect**() {
System.out.println("call onBeaconServiceConnect()");
try {
System.out.println("call notifier ");
mBeaconManager.setRangeNotifier(this);
mBeaconManager.startMonitoringBeaconsInRegion(mAllBeaconsRegion);
mBeaconManager.setMonitorNotifier(new MonitorNotifier() {
@Override
public void didEnterRegion(Region region) {
System.out.println("monitor enter " + region.getId1());
}
@Override
public void didExitRegion(Region region) {
System.out.println("monitor exit " + region.getId1());
}
@Override
public void didDetermineStateForRegion(int i, Region region) {
System.out.println("monitor " + region.getId1());
}
});
mBeaconManager.startRangingBeaconsInRegion(mAllBeaconsRegion);
} catch (RemoteException e) {
e.printStackTrace();
System.out.println("call notifier exception"+e.toString());
}
}