bluetooth lowenergy - connecting issue with android ble -


i have issue ble getting disconnecting, below code changes based on answer earlier used response show data ble device phone ,

but after code change can not data device think has "enable_indication_value" , "enable_notification_value"

can call both @ same time

public void setcharacteristicnotification(bluetoothgattcharacteristic bluetoothgattcharacteristic, boolean flag) {     if(mbluetoothadapter == null || mbluetoothgatt == null)     {         log.w(tag, "bluetoothadapter not initialized");     } else     {         mbluetoothgatt.setcharacteristicnotification(bluetoothgattcharacteristic, flag);         bluetoothgattdescriptor bluetoothgattdescriptor = bluetoothgattcharacteristic.getdescriptor(uuid.fromstring(samplegattattributes.client_characteristic_config));         if(bluetoothgattdescriptor != null)         {       bluetoothgattdescriptor.setvalue(bluetoothgattdescriptor.enable_notification_value);             mbluetoothgatt.writedescriptor(bluetoothgattdescriptor);             return;         }     } } 

later based on given stackoverflow question:

enter link description here

i changed below line

bluetoothgattdescriptor.setvalue(bluetoothgattdescriptor.enable_notification_value);

to bluetoothgattdescriptor.setvalue(bluetoothgattdescriptor.enable_indication_value);


Comments

Popular posts from this blog

Android : Making Listview full screen -

javascript - Parse JSON from the body of the POST -

javascript - Chrome Extension: Interacting with iframe embedded within popup -