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

前端 未结 1 1768
情书的邮戳
情书的邮戳 2021-01-21 23:21

Background:

I am developing an Android app that monitors for specific beacons in the background, and upon entry detection, will perform custom coding. I

相关标签:
1条回答
  • 2021-01-21 23:59

    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.

    0 讨论(0)
提交回复
热议问题