Category : bluetooth-gatt

Firstly, I need to confirm that the function works well in airplane mode, which means the problem is from the API, not the RN4020 module (my device). Secondly, when I use connectGatt() function to connect GATT server, the function returns true and the logcat shows that my app connects to GATT server, successfully. But when ..

Read more

calling notifyCharacteristicChanged() will throw this Exception: java.lang.NullPointerException: Attempt to invoke virtual method ‘int java.lang.Integer.intValue()’ on a null object reference at android.os.Parcel.readException(Parcel.java:1698) at android.os.Parcel.readException(Parcel.java:1645) at android.bluetooth.IBluetoothGatt$Stub$Proxy.sendNotification(IBluetoothGatt.java:1318) at android.bluetooth.BluetoothGattServer.notifyCharacteristicChanged(BluetoothGattServer.java:539) Source: Android..

Read more

I’m trying to connect my Android application to a ESP32 BLE gatt server and to receive some integer values through the characteristics of that server after being notified However it doesn’t seem to work This is my Java Code: import android.bluetooth.BluetoothAdapter; import android.bluetooth.BluetoothDevice; import android.bluetooth.BluetoothGatt; import android.bluetooth.BluetoothGattCallback; import android.bluetooth.BluetoothGattCharacteristic; import android.bluetooth.BluetoothGattService; import android.bluetooth.BluetoothManager; import android.bluetooth.BluetoothProfile; ..

Read more

I want save BluetoothGatt objects to manage BLE connections in my android app. Currently i am using a static android class to save those variables. But someTimes application vanishes those static variables. public class ConnectedDevicesService { private static ConcurrentHashMap<String, BluetoothGatt> bleDeviceHashMap = new ConcurrentHashMap<>(); public static void addBleDevice(String macAddress, BluetoothGatt device) { bleDeviceHashMap.put(macAddress, device); setBleDeviceMutableLiveData(bleDeviceHashMap); ..

Read more

When I try to close my GATT connection, I do the following: BluetoothGatt gatt; … private void disconnectDevice() { … if (this.gatt != null) { this.gatt.disconnect(); this.gatt.close(); this.gatt = null; } … } However, the app crashes with a NullPointerException in the this.gatt.close(); line (not in the disconnect() line) on my Samsung Galaxy S4 mini. ..

Read more