0

I am trying to build an app to get data from accelerometer through BLE. As per the android developer site I am using function setCharacteristicNotification(characteristic, true) to start data streaming from BLE device. But when callingsetCharacteristicNotification(characteristic, false) to stop data streaming, it works sometime and sometime not. I couldn't figure out what is going wrong, as I m doing everything according to information given in Android Developer Site

Can Anyone please give exact process how to stop data streaming i.e. how to successfully setCharacteristicNotification(characteristic, false).

Thanks in advance.

Zoe
  • 27,060
  • 21
  • 118
  • 148
Shadman Akhtar
  • 99
  • 2
  • 11

1 Answers1

2

The setCharacteristicNotification method only tells the Bluetooth stack in Android if it should forward notifications/indications to your app. You also need to write the configuration to the Client Characteristic Configuration descriptor. See Why does setCharacteristicNotification() not actually enable notifications?, and use https://developer.android.com/reference/android/bluetooth/BluetoothGattDescriptor.html#DISABLE_NOTIFICATION_VALUE.

Emil
  • 16,784
  • 2
  • 41
  • 52