Open
Description
When app goes into the background, "pause" event fires and I call bluetoothle.disconnect().
When app is back in foreground, I call reconnect() and it seems to reconnect OK.
But after that when getting the services the plugin crashes:
2021-07-26 15:59:35.178 11816-11855/com.app D/BluetoothGatt: onClientConnectionState() - status=0 clientIf=7 device=84:CC:A8:0D:5C:F6
2021-07-26 15:59:35.189 11816-11816/com.app I/chromium: [INFO:CONSOLE(215)] "ble connected", source: file:///android_asset/www/shared/app.ble.js (215)
2021-07-26 15:59:35.191 11816-11991/com.app D/BluetoothGatt: configureMTU() - device: 84:CC:A8:0D:5C:F6 mtu: 517
2021-07-26 15:59:35.528 11816-11855/com.app D/BluetoothGatt: onConfigureMTU() - Device=84:CC:A8:0D:5C:F6 mtu=517 status=0
2021-07-26 15:59:35.552 11816-11816/com.app I/chromium: [INFO:CONSOLE(293)] "ble MTU has been set to 517", source: file:///android_asset/www/shared/app.ble.js (293)
2021-07-26 15:59:35.552 11816-11816/com.app I/chromium: [INFO:CONSOLE(224)] "ble Getting device services.", source: file:///android_asset/www/shared/app.ble.js (224)
2021-07-26 15:59:35.553 11816-11991/com.app E/PluginManager: Uncaught exception from plugin
java.lang.NullPointerException: Attempt to invoke virtual method 'boolean java.util.LinkedList.add(java.lang.Object)' on a null object reference
at com.randdusing.bluetoothle.BluetoothLePlugin.queueAdd(BluetoothLePlugin.java:3187)
at com.randdusing.bluetoothle.BluetoothLePlugin.execute(BluetoothLePlugin.java:354)
at org.apache.cordova.CordovaPlugin.execute(CordovaPlugin.java:98)
at org.apache.cordova.PluginManager.exec(PluginManager.java:139)
at org.apache.cordova.CordovaBridge.jsExec(CordovaBridge.java:59)
at org.apache.cordova.engine.SystemExposedJsApi.exec(SystemExposedJsApi.java:41)
at android.os.MessageQueue.nativePollOnce(Native Method)
at android.os.MessageQueue.next(MessageQueue.java:342)
at android.os.Looper.loop(Looper.java:197)
at android.os.HandlerThread.run(HandlerThread.java:67)
2021-07-26 15:59:35.553 11816-11816/com.app I/chromium: [INFO:CONSOLE(912)] "ble reading DevInfo", source: file:///android_asset/www/shared/app.ble.js (912)
The crash happened in queueAdd() function (Android java code) at queue.add(operation);
//Helpers for Callbacks
private void queueAdd(Operation operation) {
JSONArray args = operation.args;
CallbackContext callbackContext = operation.callbackContext;
JSONObject obj = getArgsObject(args);
if (isNotArgsObject(obj, callbackContext)) {
return;
}
String address = getAddress(obj);
if (isNotAddress(address, callbackContext)) {
return;
}
HashMap<Object, Object> connection = connections.get(address);
if (connection != null) {
LinkedList<Operation> queue = (LinkedList<Operation>) connection.get(keyQueue);
queue.add(operation);
queueStart(connection);
}
}
Metadata
Metadata
Assignees
Labels
No labels