0
votes

I'm using AltBeacon library inside service to find my beacon every 1 second when the app on foreground. On Galaxy s7 when the app go's to background it stop find the beacon every second, instead it return data every few seconds between 5 - 30 secs. I can see that "didRangeBeaconsInRegion" call every second but it return with out beacons most of the time.

I need to keep the behavior of foreground when the app is in background.

This is my BeaconManager configuration:

private static long EXIT_PERIOD = 16500;
private static long SCAN_PERIOD = 1150;
.
.
.
beaconManager = BeaconManager.getInstanceForApplication(this);
BeaconManager.setRegionExitPeriod(EXIT_PERIOD);
beaconManager.setBackgroundScanPeriod(SCAN_PERIOD);
beaconManager.setForegroundScanPeriod(SCAN_PERIOD);
beaconManager.setBackgroundBetweenScanPeriod(0);

Tnx

1

1 Answers

1
votes

Some builds of Android 7.x for Samsung devices put Bluetooth scans into low power mode when an app has no activities in the foreground. The reason you see Les frequent detections is because that is how low power scans on Android behave.

You can read more about this issue here:

https://github.com/AltBeacon/android-beacon-library/issues/483

To be clear, this is appears to be a Samsung-specific customization to Android. There is no known workaround to keep the OS from overriding a low latency scan with a low power one.