I'm developing an application that connects to a Bluetooth Low Energy Device. The architecture of the program requires it to collect data from this device in bursts. Example: Collect data for 30 seconds once every 3 minutes. It is very important for this to be battery efficient.
For this device I have subscribed to notifications from a BluetoothGattCharacteristic. Unfortunately read permission is not given on this characteristic, so notifications must be used.
descriptor.setValue(BluetoothGattDescriptor.ENABLE_NOTIFICATION_VALUE);
mBluetoothGatt.writeDescriptor(descriptor);
and
mBluetoothGatt.setCharacteristicNotification(characteristic, true);
My first idea is to simply set
mBluetoothGatt.setCharacteristicNotification(characteristic, false);
when not scanning for data. Will this still consume lots of battery life? I assume the callbacks are still listening. Would I be required to change the descriptor back to its non-notification state?
Another idea would be to connect only when reading data from sensors, and disconnect when done. This would mean reconnecting ~20 times an hour.