i am trying to read temperature value from health profile.health thermometer service. according to official google ble devlopment page when i try to notify a health thermometer characteristic to read temperature i try to write descriptor value (Client Characteristic Configuration) using writeDescriptor a callback method of writeDescriptor return status 5 according to google it's GATT_INSUFFICIENT_AUTHENTICATION. so i comment the code of writedescriptor and try to call the method mBluetoothGatt.setCharacteristicNotification(characteristic, enabled); but onCharacteristicChanged method never called. when i talk to my ios devloper team. they said that they never write a descriptor value they just set the notification to true and they get temperature value from the same chip. to write a descriptor value is necessary for android developer to get notification ??? so at last i try to run the official bluetooth app from the bluetooth.com site for test purpose they just disable all three buttons notify read and write??? thank you and sorry for my English
[UPDATE]
find out some log which may cause some bonding issues please help me if you have any solution for that.
Short-Term Key generated still log as error
11-08 11:26:44.392: E/bt-smp(1014): STK Generated
after that bond state change dramatically may this cause insufficient authentication
11-08 11:26:49.437: I/BluetoothBondStateMachine(1014): bondStateChangeCallback: Status: 0 Address: 00:16:A4:C0:FF:EE newState: 2
11-08 11:26:49.437: D/BtGatt.btif(1014): btif_gattc_upstreams_evt: Event 9
11-08 11:26:49.437: E/BluetoothBondStateMachine(1014): In stable state, received invalid newState: 12
[UPDATE]
after upgrading kitkat 4.4 on nexus 7 . add two method
device.createBond();
device.setPairingConfirmation(true);
works for me now i can read the encrypted characteristic. but still unstable. but some success i got.
Yes, in Android for enabling BLE notification, you must both call mBluetoothGatt.setCharacteristicNotification(characteristic, enabled) and write suitable value to descriptor 0x2902 of that characteristic.
I am not sure why you get GATT_INSUFFICIENT_AUTHENTICATION, this may be caused by the implementation of the thermometer.
EDIT : From the new information in the comment and also the screen captured provided, there are a few things you may want to check :
The characteristic is a indication characteristic, but not a notification characteristic. The value you write to the descriptor should be BluetoothGattDescriptor.ENABLE_INDICATION_VALUE, but not BluetoothGattDescriptor.ENABLE_NOTIFICATION_VALUE. Notice that you still need to turn on the indication by setCharacteristicNotification(). (Confusing terminology here, but it is necessary as per the docs)
For the unstable Bluetooth stack on Android, try to restart the Bluetooth, and turn of WiFi. This will increase the stability. (Although not 100% solving the problem)