哪种电池使用效果更好?蓝牙始终打开还是间歇性地打开/关闭?

发布于 2024-12-15 00:46:33 字数 121 浏览 6 评论 0原文

我正在编写一个需要蓝牙的应用程序。我定期检查是否需要同步一些数据。 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

梦里泪两行 2024-12-22 00:46:33

我认为您不应该强制用户使用 BT 状态,无论出于何种原因他们可能更愿意将其保持打开或关闭状态。您的应用程序可以做的唯一一件事就是要求用户在需要时打开 BT(使用意图 BluetoothAdapter.ACTION_REQUEST_ENABLE),如果您每隔 3000 万左右询问一次,它很快就会变得烦人。

请记住,未经用户同意,不得使用BluetoothAdapter 中的enable() 方法(来自sdk 参考):

未经用户直接同意,切勿启用蓝牙。如果要打开蓝牙以创建无线连接,则应使用 ACTION_REQUEST_ENABLE Intent,这将引发一个对话框,请求用户允许打开蓝牙。 enable() 方法仅适用于包含用于更改系统设置的用户界面的应用程序,例如“电源管理器”应用程序。

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):

Bluetooth should never be enabled without direct user consent. If you want to turn on Bluetooth in order to create a wireless connection, you should use the ACTION_REQUEST_ENABLE Intent, which will raise a dialog that requests user permission to turn on Bluetooth. The enable() method is provided only for applications that include a user interface for changing system settings, such as a "power manager" app.

西瑶 2024-12-22 00:46:33

我认为这实际上取决于您检查之间的时间间隔。如果检查间隔较长,最好打开/关闭,否则,如果检查频繁,保持打开可能不会有太大区别。

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.

黯然 2024-12-22 00:46:33

添加一个按钮“打开蓝牙并同步”,结束后向用户提供反馈,然后请求将其关闭。

Add a button to "turn on bluetooth and sync", when it's over give the user feedback and then request to turn it off.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文