【发布时间】:2015-05-26 17:07:53
【问题描述】:
我正在开发一个连接到蓝牙低功耗设备的应用程序。该程序的架构要求它从该设备中以突发方式收集数据。示例:每 3 分钟收集一次 30 秒的数据。 电池效率非常重要。
对于这个设备,我已经订阅了来自 BluetoothGattCharacteristic 的通知。不幸的是,这个特性没有被授予读取权限,所以必须使用通知。
descriptor.setValue(BluetoothGattDescriptor.ENABLE_NOTIFICATION_VALUE);
mBluetoothGatt.writeDescriptor(descriptor);
和
mBluetoothGatt.setCharacteristicNotification(characteristic, true);
我的第一个想法是简单地设置
mBluetoothGatt.setCharacteristicNotification(characteristic, false);
不扫描数据时。这仍然会消耗大量电池寿命吗?我假设回调仍在监听。我是否需要将描述符更改回其非通知状态?
另一个想法是仅在从传感器读取数据时连接,完成后断开连接。这意味着每小时重新连接约 20 次。
【问题讨论】:
标签: java android bluetooth-lowenergy battery battery-saver