Responsiveness of Background Beacon Monitoring (Android Beacon Library / Kontakt SDK / Estimote SDK)

∥☆過路亽.° 提交于 2019-12-02 00:10:02

BackgroundPowerSaver automatically switches between constant scanning (foreground) and duty cycle scanning (background). If you remove it, you will end up with constant scanning all the time which will use much more power on Android 4.3-7.x.

Android 8, however has new restrictions that block doing this. The OS limits background apps to running no longer than 10 minutes at a time in the background. This OS restriction exists regardless of which scanning SDK or built-in API you use. The job scheduler on Android 8 allows scheduled scan jobs to be run at most every 15 minutes (which sometimes take longer to run due to OS delays), so that is the limiting factor in how often scans can be run.

I wrote a blog post about this here

If you want to achieve constant background scanning, set up a foreground service with your app. A foreground service shows an icon to users at the top of the screen to let them know it is running, then allows apps to keep running in the background indefinitely, even on Android 8.

EDIT: on Android 8.1+ if the screen is off, scans will be blocked unless you have a filter attached to them. Android Beacon Library 2.13 and higher automatically set up a filter to ensure these scans are not blocked in this case. Make sure you have that version if testing on Android 8.1+ with the screen off.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!