Bluetooth Scanning on Android Oreo

Successive Android versions have become increasingly strict on what goes on in background in order to save battery power. The usual way of scanning for beacons on Android is to have an Android Service that uses the Bluetooth API to scan for beacons every n seconds. From Android Oreo (8.0), this is no longer reliable as the OS has background limitations that kill the Service soon after the app UI has gone from the foreground.

Apps now have to use the BluetoothManager BluetoothLEScanner call that sets up a callbackIntent that fires when beacons are seen.

“The scan results will be delivered via the PendingIntent. Use this method of scanning if your process is not always running and it should be started when scan results are available.”

Apps that target multiple Android versions need to support both the old and new mechanisms which complicates development (and support).

We offer development services should you need any further advice.