后台信标监视的响应能力(Android信标库/ Kontakt SDK / Estimote SDK) [英] Responsiveness of Background Beacon Monitoring (Android Beacon Library / Kontakt SDK / Estimote SDK)

查看:170
本文介绍了后台信标监视的响应能力(Android信标库/ Kontakt SDK / Estimote SDK)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

背景:

我正在开发一个Android应用,该应用可在后台监视特定的信标,并在检测到条目时执行自定义编码。
我目前正在使用Android Beacon Library进行探索,并且能够在大多数时间(屏幕处于打开状态)(几秒钟内)以响应方式检测到该信标。

I am developing an Android app that monitors for specific beacons in the background, and upon entry detection, will perform custom coding. I am currently exploring this using Android Beacon Library, and is able to detect the beacon responsively most of the time when the screen is On (within seconds).

但是,当屏幕关闭时,响应速度会下降,可能需要几分钟到半小时才能检测到。

However, when the screen is off, the responsiveness drops and may take minutes to half and hour to detect.

我想知道是否有提高响应速度的方法,因为我的使用情况需要响应背景检测而不必打开电话(看着可靠的< 1分钟响应时间)。

I am wondering if there are ways to improve responsiveness as my usage scenario requires a responsive background detection without having to turn on the phone (looking at a reliable < 1 minute response time).

我目前正在使用Android 8进行测试,但最终需要支持Android 6 +。

I am using Android 8 to test at the moment, but will need to support Android 6+ eventually.

特定问题:

1)使用Android Beacon库,我正在使用 new BackgroundPowerSaver行对参考应用程序进行实验(这个)。删除此行是否会以更高的功耗使用为代价来提高响应速度(在Android 5-7,Android 8中)?

1) Using Android Beacon Library, I am experimenting with the reference app with the line "new BackgroundPowerSaver(this)". Does removing this line improve responsiveness (in Android 5-7, Android 8) at a cost of more power usage?

2)当我尝试删除 new BackgroundPowerSaver(this)行时,该应用程序停止运行(无法监视,也无法进行测距)。我已在清单中添加了蓝牙和精确位置权限。

2) When I tried to remove the "new BackgroundPowerSaver(this)" line, the app stop working (unable to monitor, nor do ranging). I have added Bluetooth and fine-locations permissions in my manifest. How do I make this work without the backgroundpowersaver?

3)除了Android Beacon库,我还没有探索其他SDK,例如Kontakt和Estimote的SDK。与Android Beacon库相比,这些SDK是否能够支持响应更快的后台监视?

3) Besides Android Beacon Library, I have yet to explore other SDKs such as those from Kontakt and Estimote. Are these SDKs able to support a more responsive background monitoring compared to Android Beacon Library?

4)除了Android Beacon库,如果我直接使用Android蓝牙API,则有可能获得实现后台所需的响应能力?有参考应用程序吗?

4) Besides Android Beacon Library, if I use Android bluetooth APIs directly, possible to get achieve the responsiveness required in background? Any reference applications?

谢谢。

推荐答案

BackgroundPowerSaver会自动在恒定扫描(前景)和占空比扫描(背景)。如果将其删除,最终将一直持续扫描,这将在Android 4.3-7.x上使用更多功能。

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,但是有新的限制来阻止这样做。 操作系统限制后台应用一次在后台运行的时间不得超过10分钟。无论您使用哪种扫描SDK或内置API,都存在此操作系统限制。 Android 8上的作业计划程序最多允许每15分钟运行一次计划的扫描作业(由于操作系统延迟,有时可能需要更长的时间才能运行) ),因此这是运行扫描频率的限制因素。

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.

我写了一篇有关此此处

如果您想要实现持续的后台扫描,请在您的应用中设置前台服务。前台服务在屏幕顶部向用户显示一个图标,让他们知道它正在运行,然后允许应用程序无限期地在后台运行,即使在Android 8上也是如此。

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.

编辑:在Android 8.1及更高版本上,如果屏幕关闭,除非您附加了过滤器,否则扫描将被阻止。 Android Beacon Library 2.13和更高版本会自动设置过滤器,以确保在这种情况下不会阻止这些扫描。如果在关闭屏幕的情况下在Android 8.1+上进行测试,请确保具有该版本。

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.

这篇关于后台信标监视的响应能力(Android信标库/ Kontakt SDK / Estimote SDK)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆