How do Android and iOS scan for Bluetooth beacons

2019-05-11 05:24发布

问题:

if i want to develop own my iBeacon services in Android or IOS, it has to be practical. which means customer can use my services without shortage of battery.

i think even if iBeacon technology is based on Bluetooth Low Energy, it could be still lack of battery. that's because an application must be running to scan iBeacon device all the time.

As i know, iOS has its own solution for battery issue. when an IOS application detect iBeacon devices, it is running in the background and IOS(not app) is scanning specific UUIDs by itself, not the all UUIDs nearby. this is how they save energy. am i right?

but in case of Android, any solution for battery issue is not provided. what's more, when an Android application detects iBeacon devices, it scans all the UUIDs nearby and it deals with everything, not the Android OS. is this right?

so Im worry about this battery problems, before i start to develop own my services. is it gonna be ok with battery? is there any good solution to share?? how do you guys solve this problem??

回答1:

The Pro version of the Android iBeacon Library comes with an automatic battery saver that slows down scans when the app is in the background to save battery. The open source Android iBeacon Library also allows configuration of a foreground and background bluetooth scan rate, and provides methods to call to tell the library when the app is in the foreground and the background.

On iOS the battery saving strategy is similar. When no app is ranging for iBeacons in the foreground, bluetooth scans are not performed constantly. The exact frequency of background scans is not published, but I have measured it happening once every 15 minutes on a iPhone 4S with iOS 7.1.

Scanning for specific UUIDs has no effect on battery life. At the OS-level, a Bluetooth LE scan looks for any Bluetooth LE device that is advertising regardless of whether it is an iBeacon or whether it has a specific UUID. The filter for specific UUIDs is handled in software at a higher level.