如何检查由蓝牙扫描引起的电池消耗 [英] How to check battery consumption caused by Bluetooth Scans

查看:99
本文介绍了如何检查由蓝牙扫描引起的电池消耗的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个Android应用程序,用于使用Android Beacon库检测Eddystone信标.我想测试由应用程序引起的电池消耗,以找到最佳的背景和前景扫描速率.在设置">应用程序">"MyBeaconDetectorApp"中,将蓝牙打开一个多小时后,其电量显示为0%.我认为该应用程序是在后台,因此它是0%.但是,如何检查蓝牙扫描引起的电池消耗.我已将BackgroundBetweenScanPeriod设置为1分钟.

I have an Android application to detect Eddystone beacons using the Android Beacon Library. I would like to test the battery consumption caused by the application to find the optimal background and foreground scan rates. In Settings > Apps > MyBeaconDetectorApp, it shows 0% battery usage after having the bluetooth On for more than an hour. I think the application is in background and hence it is 0%. However, how do I check the battery consumption caused by Bluetooth scans. I have set my BackgroundBetweenScanPeriod as 1 minute.

谢谢

推荐答案

虽然很难直接测量电池消耗,但这是我使用的技术:

While it is difficult to measure the battery consumption directly, here is the technique I use:

  1. 使用安装了有限数量的将在后台运行的应用程序的测试设备.恢复出厂设置后,最好使用库存的Nexus设备.

  1. Use a test device with a limited number of apps installed that will be running in the background. A stock Nexus device after factory reset is ideal.

将电池充电至100%

将设备置于飞行模式并打开蓝牙.

Put the device into airplane mode and put bluetooth on.

安装您的应用程序,使其在后台运行.关闭屏幕,然后断开设备的USB连接器.

Install your app start it running in the background. Turn off the screen, and disconnect the device's USB connector.

注意开始时间.

让应用在后台运行至少8个小时,理想情况下,至少要有一个信标.

Let the app run in the background for at least 8 hours, ideally in the presence of at least one beacon.

测量电池电量. 100%的增量是消耗百分比.注意这个数字和结束时间.

Measure the battery level. The delta from 100% is the percentage drain. Note this number and the end time.

查找手机型号电池的电量.将百分比泄漏率乘以mAH,然后除以测试时间(以小时为单位).这会告诉您手机在运行您的应用程序时会消耗多少mA.

Look up how many mAH your battery has for your phone model. Multiply the percentage drain by the mAH and divide by the time of the test in hours. This tells you how many mA the phone uses when running your app.

下一步,卸载您的应用程序,然后重复上述步骤.这将使您的设备 在没有运行应用程序的情况下消耗基线电量.

Next, uninstall your app, and repeat the procedure above. This will give you a baseline battery drain for your device without your app running.

最后,在运行应用程序的情况下,从mAH中减去mAH基线,以测量应用程序使用的额外mAH.

Finally, subtract the mAH baseline from the mAH with your app running to measure the additional mAH used by your app.

最后一点:如果您真的在后台每分钟扫描一次(默认是每5分钟一次以节省电池),那么我预计这可能会导致大量的额外电池消耗.使用上面的步骤进行测试可以肯定地告诉您.我很想听听您的结果!

One final note: if you are really scanning every minute in the background (the default is every five minutes to save battery), I would expect this may cause a significant additional battery drain. Testing using the procedure above will tell you for sure. I'd love to hear your results!

这篇关于如何检查由蓝牙扫描引起的电池消耗的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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