Hi, ``
Very usefull project, it help me a lot ! thanks ;)
But...
I've an issue, and don't understand why i've this... When I run it, for the read, all is ok, but when i want to write characteristic, nothing happen... no toast, no reception on ble. So I've put some else{} in the onEditorAction. it seem like this:
private TextView.OnEditorActionListener editorListener = new TextView.OnEditorActionListener() {
@OverRide
public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
boolean handled = false;
if (actionId == EditorInfo.IME_ACTION_SEND) {
if (mBluetoothLeService != null && bluetoothGattCharacteristicBLE != null) {
String value = mEditField.getText().toString();
mBluetoothLeService.writeCharacteristic(bluetoothGattCharacteristicBLE, value);
mBluetoothLeService.setCharacteristicNotification(bluetoothGattCharacteristicBLE, true);
Toast.makeText(DeviceControlActivity.this, "Done", Toast.LENGTH_SHORT).show();
mEditField.clearFocus();
mEditField.onEditorAction(EditorInfo.IME_ACTION_DONE);
}else{
Log.e(TAG, "Service = " + mBluetoothLeService + " Charac = " + bluetoothGattCharacteristicBLE);
}
handled = true;
}else{
Toast.makeText(DeviceControlActivity.this, "Not done", Toast.LENGTH_SHORT).show();
}
return handled;
}
};
And in logs, I receive:
E/DeviceControlActivity: Service = com.example.android.bluetoothlegatt.BluetoothLeService@a23bbe5 Charac = null
It seems like my bluetoothGattCharacteristicBLE is null... but why ? Can you maybe help me ?
Hi, ``
Very usefull project, it help me a lot ! thanks ;)
But...
I've an issue, and don't understand why i've this... When I run it, for the read, all is ok, but when i want to write characteristic, nothing happen... no toast, no reception on ble. So I've put some else{} in the onEditorAction. it seem like this:
And in logs, I receive:
E/DeviceControlActivity: Service = com.example.android.bluetoothlegatt.BluetoothLeService@a23bbe5 Charac = null
It seems like my bluetoothGattCharacteristicBLE is null... but why ? Can you maybe help me ?