Android Bluetooth LE Disable Notification Feedback Battery Response?

I am developing an application that connects to a Bluetooth Low Energy Device. The architecture of the program requires that it collect data from this device in packets. Example: Collect data for 30 seconds once every 3 minutes. For this, it is very important that the battery is efficient.

For this device, I subscribed to notifications from BluetoothGattCharacteristic. Unfortunately, there is no read permission specified for this trait, so notifications must be used.

descriptor.setValue(BluetoothGattDescriptor.ENABLE_NOTIFICATION_VALUE);     
mBluetoothGatt.writeDescriptor(descriptor);

      

and

mBluetoothGatt.setCharacteristicNotification(characteristic, true);

      

My first idea is to just install

mBluetoothGatt.setCharacteristicNotification(characteristic, false);

      

when scanning data. Will it still consume a lot of battery life? I am assuming the callbacks are still listening. Should I request to change the handle back to its state without notice?

Another idea would be to connect only when reading data from sensors and disconnect when finished. This would mean reconnecting ~ 20 times per hour.

+3


source to share


1 answer


Sentence

I suggest reading feature values ​​rather than setting them for notification. This way, you only need to communicate when you need data from a BLE device.

Questions



1) How often do you think the characteristic data will change from the side of the BLE device.

2) Are you worried about running out of battery on the BLE device or phone battery side?

0


source







All Articles