Я установил уведомление в android, оно не вызывает метод _1 _ ???? В функцию не входит. Почему так происходит ??
Любая помощь приветствуется
Запросите решения.
Это мой код:
private final BluetoothGattCallback mGattCallback = new BluetoothGattCallback() {
@Override
public void onConnectionStateChange(BluetoothGatt gatt, int status,
int newState) {
if (newState == BluetoothProfile.STATE_CONNECTED) {
Log.i(TAG, "Connected to GATT server.");
// Attempts to discover services after successful connection.
Log.i(TAG, "Attempting to start service discovery:"
+ mBluetoothGatt.discoverServices());
} else if (newState == BluetoothProfile.STATE_DISCONNECTED) {
Log.i(TAG, "Disconnected from GATT server.");
}
}
@Override
public void onServicesDiscovered(BluetoothGatt gatt, int status) {
if (status == BluetoothGatt.GATT_SUCCESS) {
gattServices = mBluetoothGatt
.getService(SampleGattAttributes.SERVICES_UUID);
if (gattServices != null) {
gattCharacteristics = gattServices
.getCharacteristic(SampleGattAttributes.CHARACTERISTIC_UUID);
System.out.println("character-->" + gattCharacteristics);
}
if (gattCharacteristics != null) {
System.out.println("Characteristic not null");
System.out.println("Characteristic Properties-->"
+ gattCharacteristics.getProperties());
mBluetoothGatt.setCharacteristicNotification(gattCharacteristics,
true);
}
} else {
Log.w(TAG, "onServicesDiscovered received: " + status);
}
}
@Override
public void onCharacteristicRead(BluetoothGatt gatt,
BluetoothGattCharacteristic characteristic, int status) {
System.out.println("in read");
if (status == BluetoothGatt.GATT_SUCCESS) {
byte[] data = characteristic.getValue();
System.out.println("reading");
System.out.println(new String(data));
}
}
@Override
public void onCharacteristicChanged(BluetoothGatt gatt,
BluetoothGattCharacteristic characteristic) {
//
System.out.println("change");
byte[] data = characteristic.getValue();
System.out.println(new String(data));
}
};
Заранее спасибо!!