Radius Networks Developer Blog

We’ve previously discussed how to prepare your beacon-aware app to continue to function by complying with important changes on Android 6. Now that Android 6 has been generally available for several months we’ve learned a few more things. This covers some extremely important beacon-related behavior you need to know.

Location Services

You’re probably already aware that you need Location Services runtime permissions on Android 6. What you may not realize is that Location Services must also be ON.

If the service is OFF the logs will continue to show successful scans. However, you won’t see it find any beacons and your registered callbacks will sit idle. Our understanding is that this is the intended behavior for Android 6+ and is here to stay.

Additionally, you may have noticed a new Bluetooth scanning option under the new Scanning settings for your device’s Location Services. This setting currently has no effect on the general BLE scanning available to applications. So even with this setting ON if Location Services is OFF beacons will not be detected.

Foreground vs Background Scanning

There are some additional subtleties with foreground and background scanning. These revolve around whether your app is targeting API 23 or attempting to leverage the older permission model by targeting API 22 or lower.

The short answer is if you target API 22 or lower you can perform foreground scanning while Location Services is OFF. However, background scanning will not work. Background scanning will always require Location Services to be ON with Android 6+.

Location Services State for Scanning on Android 6

Targeting API Foreground Scanning Background Scanning
API 23+ ON ON
API < 23 ON or OFF ON

Why the Change?

Based on responses on the Android issue tracker this is to better protect user privacy. Part of the BLE scan reports the MAC address of the BLE device. It is theoretically possible that someone could create a map of beacon MAC addresses to determine a user’s geographical location.

This brings Android more in-line with how iOS works. Each operation system now views beacon detection as part of Location Services. They each require appropriate service authorization prior to use and both Bluetooth and Locations Services need to be turned on.