BLE android notifications read

2019-09-15 01:12发布

问题:

I'm experiencing an android application on Android Studio.

I'm actually able to enable and receive notifications or characteristics reads without problem.

Where I'm a bit stuck it's when I read characteristics (by button) if notifications are enable. In my application the data from characteristics reading is right on a case and the notification's data on an other case. But when I read characteristics when notifications are enable, sometimes data exchange their places.

I tried to put a global variable which take a value on the ChangeValue Callback but it's not working all the time.

All of my new data is going on the class:

private final BroadcastReceiver mGattUpdateReceiver = new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) {

So here is my question, how to differentiate both data on this function?