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

OpenCV OpenCL: Convert Mat to Bitmap in JNI Layer for Android -

android - org.xmlpull.v1.XmlPullParserException: expected: START_TAG {http://schemas.xmlsoap.org/soap/envelope/}Envelope -

python - How to remove the Xframe Options header in django? -