哪种电池使用效果更好?蓝牙始终打开还是间歇性地打开/关闭?
我正在编写一个需要蓝牙的应用程序。我定期检查是否需要同步一些数据。 Wrt电池使用哪个更好?
- 始终开启蓝牙并在需要通信时使用它。
或者 - 在需要时将其打开并关闭。
I'm writing a app that requires bluetooth. I periodically check if I need to synchronize some data.
W.r.t battery usage which is better ?
- Having bluetooth always on and using it when needed for communication.
OR - Switching it on when needed and switching it off.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我认为您不应该强制用户使用 BT 状态,无论出于何种原因他们可能更愿意将其保持打开或关闭状态。您的应用程序可以做的唯一一件事就是要求用户在需要时打开 BT(使用意图 BluetoothAdapter.ACTION_REQUEST_ENABLE),如果您每隔 3000 万左右询问一次,它很快就会变得烦人。
请记住,未经用户同意,不得使用BluetoothAdapter 中的enable() 方法(来自sdk 参考):
I believe you shouldn't force the BT state on the users, for whatever reasons they might prefer to keep it on or off. The only thing you application can do is to ask the user to switch BT on whenever you need it (using intent BluetoothAdapter.ACTION_REQUEST_ENABLE), and if you ask every 30mn or so it is rapidly going to be annoying.
Remember the enable() method in BluetoothAdapter should not be used without user consent (from sdk reference):
我认为这实际上取决于您检查之间的时间间隔。如果检查间隔较长,最好打开/关闭,否则,如果检查频繁,保持打开可能不会有太大区别。
I think it really depends on the time interval between your checks. If the checks are at large intervals, it's better to switch on/off, otherwise, if they are often it probably won't make much difference to keep in on.
添加一个按钮“打开蓝牙并同步”,结束后向用户提供反馈,然后请求将其关闭。
Add a button to "turn on bluetooth and sync", when it's over give the user feedback and then request to turn it off.