其他分享
首页 > 其他分享> > android – 自从Lollipop以来,为什么扫描iBeacons使用更少的电池?

android – 自从Lollipop以来,为什么扫描iBeacons使用更少的电池?

作者:互联网

根据Android Beacon Library的documentation,

Fast background detections on Android 5.0+

On Android 5.0, new scanning APIs allow for more efficient background scanning that saves provide similar power savings to the technique described above, but with much faster beacon detection times. Instead of it taking up to five minutes to detect a beacon (with the defaults described above), it detections of new beacons generally take place within a few seconds.

但是看看Android的官方文档,我能找到的主要新东西是API 21中引入的BlueToothLeScanner.
这个新类的文档没有提到使用更少能量的任何内容.

假设Android Beacon Library也在使用这些框架,为什么它会节省更多能量呢?
即,这个库的处理与我自己的应用程序中调用startScan()有什么不同,而不使用这个库?

解决方法:

Android 5引入了支持扫描过滤器的新扫描API,它在BLE广告包中寻找字节模式.这些滤波器专为在硬件中实现这些滤波器的蓝牙芯片而设计.这意味着蓝牙芯片将卸载所有处理,直到匹配为止,然后才将数据包发送到操作系统.从电池角度来看,这更有效.我在引入扫描过滤器时对Nexus 5进行的测试表明,过滤器使用的电量是未过滤扫描电池的10%.新手机上的新一代芯片效率更高.

标签:android,ibeacon,android-ibeacon,beacon
来源: https://codeday.me/bug/20190701/1347534.html