Radius Networks Developer Blog

It’s common for beacon-enabled apps to want to detect beacons, even when the app is not running in the foreground. Since looking for beacons requires Bluetooth LE scanning, doing this constantly in the background can be a real battery drain.

The good news is that Android 5.0 has implemented new APIs that allow background scanning that is much easier on the battery.

The scanning APIs have been completely redone on Android 5.0, and look like this:

BluetoothLeScanner scanner = getBluetoothAdapter().getBluetoothLeScanner();
ScanSettings settings = new ScanSettings.Builder()
List<ScanFilter> filters = new ArrayList<ScanFilter>();
scanner.startScan(filters, settings, myCallbackMethod);

Note the scan mode above is set to SCAN_MODE_LOW_POWER (also the default), which is suitable for background use. A second mode, SCAN_MODE_LOW_LATENCY, provides faster detection of Bluetooth LE advertisements (and beacons) while expending more power.

In order to see how these two modes behave, we ran tests scanning in each mode. We used a Nexus 5 with Android 5.0 to scan for beacons in our offices in a location where dozens of beacons are active. Doing this over a period of two hours while the phone was in airplane mode (but with bluetooth on), we measured the battery drain in each mode, along with some stats on the maximum time between beacon detections. Here’s what we found:

Test Duration 134 minutes 152 minutes
Battery Level Change -13% -25%
Battery Drain Rate* 268mA 454mA
Relative Battery Savings 41%
Typical time between detections 4400 ms 100 ms

Based on the above, you can see that LOW_POWER mode uses a little more than half as much battery per hour than LOW_LATENCY. The tradeoff appears to be in the detection times. Even though a similar number of beacon advertisements were detected per hour, in LOW_POWER mode they were typically delivered only every 4 seconds as compared to near-real-time in LOW_LATENCY mode

The above tests probably understate the battery savings, for two reasons:

  1. They do not account for battery usage by system overhead.
  2. The tests were performed in Radius Networks’ labs where dozens of beacons are typically detectable. This clearly makes the Android system work harder, even in LOW_POWER mode.

This feature is important, because it allows apps wanting to detect beacons in the background to respond within 4 seconds to beacon detections. With scanning APIs available on Android 4.3 and 4.4, background detections must either use lots of battery power, or cycle on and off every few minutes to save battery.

As the final release of Android 5.0 comes closer, Radius Networks is working on adding support to the open source Android Beacon Library for this low power scanning feature. Those who would like to see the details are welcome to check out the Android L APIs branch of the library on GitHub

We here at Radius Networks are excited to see Android catching up with iOS in this area. Many of our developer-partners and customers have been asking us for this functionality. With Android 5.0, we will be even closer to parity with iOS.

* Based on Nexus 5 battery capacity of 2300mAH