androidaltbeaconbeaconeddystoneeddystone-url

Android Beacon Library don´t scan when device is in doze mode


I have kontakt.io Eddystone beacon and try to write app for scanning beacon. I use Android Beacon Library and background scanning. Everything is ok and my app find beacons in few seconds. But if I simulate Doze mode using this manual http://developer.android.com/training/monitoring-device-state/doze-standby.html

finding takes about 5 minutes. Sometimes is few second, but sometimes 5 minutes .

This article say that I don´t have to make any changes in code for Doze mode. http://developer.radiusnetworks.com/2015/09/29/is-your-beacon-app-ready-for-android-6.html

I have OnePlus One with Android 6.

Please, can you tell me where may be a problem?


Solution

  • When in the background, the Android Beacon Library uses two techniques to find beacons on Android 5+:

    1. Hardware Bluetooth LE packet filters. These will alert your app within a few seconds if tripped.

    2. Periodic Bluetooth LE scans, by default, these run every five minutes in the background. They are intended as a backup should the above filters fail.

    The description in the question suggests the hardware filters are not operating under the conditions of the test (One Plus. Android 6, Doze mode.) On other devices in Doze mode, such as the Nexus 9, hardware filters are known to work in Doze mode. The difference may be firmware specific, meaning it behaves differently on different Android models.

    For most applications, fast detection in Doze mode is not critical, as the phone is motionless in this mode and unlikely to encounter any new fixed position beacons.