I want to continual read the rssi after gatt is connected.code like this:
final BluetoothDevice device = mBluetoothAdapter
.getRemoteDevice(address);
if (device == null) {
Log.w(TAG, "Device not found. Unable to connect.");
return false;
}
mBluetoothGatt = device.connectGatt(this, false, mGattCallback);
Log.d(TAG, "Trying to create a new connection.");
boolean readRssiFlag = mBluetoothGatt.readRemoteRssi();
Log.i(TAG,"readRssiFlag: "+readRssiFlag);
the mGattCallback like this:
private final BluetoothGattCallback mGattCallback = new BluetoothGattCallback() {
....
@Override
public void onReadRemoteRssi(BluetoothGatt gatt, int rssi, int status) {
Log.i(TAG,"rssi = " + rssi);
}
...
};
and onReadRemoteRssi does not work. ple tell me how to modify the code, or other solutions to read the rssi!
Thanks for your advise!