{"action":"closed","issue":{"url":"https://api.github.com/repos/don/cordova-plugin-ble-central/issues/376","repository_url":"https://api.github.com/repos/don/cordova-plugin-ble-central","labels_url":"https://api.github.com/repos/don/cordova-plugin-ble-central/issues/376/labels{/name}","comments_url":"https://api.github.com/repos/don/cordova-plugin-ble-central/issues/376/comments","events_url":"https://api.github.com/repos/don/cordova-plugin-ble-central/issues/376/events","html_url":"https://github.com/don/cordova-plugin-ble-central/issues/376","id":215046327,"number":376,"title":"Connect error on Android","user":{"login":"loopezz","id":11312418,"avatar_url":"https://avatars2.githubusercontent.com/u/11312418?v=3","gravatar_id":"","url":"https://api.github.com/users/loopezz","html_url":"https://github.com/loopezz","followers_url":"https://api.github.com/users/loopezz/followers","following_url":"https://api.github.com/users/loopezz/following{/other_user}","gists_url":"https://api.github.com/users/loopezz/gists{/gist_id}","starred_url":"https://api.github.com/users/loopezz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/loopezz/subscriptions","organizations_url":"https://api.github.com/users/loopezz/orgs","repos_url":"https://api.github.com/users/loopezz/repos","events_url":"https://api.github.com/users/loopezz/events{/privacy}","received_events_url":"https://api.github.com/users/loopezz/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":4,"created_at":"2017-03-17T15:58:10Z","updated_at":"2017-04-05T14:55:13Z","closed_at":"2017-04-05T14:55:13Z","body":"At the moment I can't connect to my Bluetooth module with a Galaxy S6 Edge device (SM-G925F; Android 6.0.1). However, the same code works on a Galaxy XCover 3 (SM-G389F; Android 6.0.1).\r\n\r\nThis is some debug information on Galaxy S6 Edge.\r\nAndroid Studio:\r\n```\r\n03-17 16:46:33.891 25393-25887/com.xxxxx D/BLEPlugin: action = connect\r\n03-17 16:46:33.891 25393-25887/com.xxxxx D/BluetoothGatt: connect() - device: D8:80:39:F0:ED:5F, auto: false\r\n03-17 16:46:33.891 25393-25887/com.xxxxx D/BluetoothGatt: registerApp()\r\n03-17 16:46:33.891 25393-25887/com.xxxxx D/BluetoothGatt: registerApp() - UUID=9716a3a1-a470-4286-86ca-bb61d66fbf96\r\n03-17 16:46:33.941 25393-25608/com.xxxxx D/BluetoothGatt: onClientRegistered() - status=0 clientIf=8\r\n03-17 16:46:33.941 25393-25887/com.xxxxx W/PluginManager: THREAD WARNING: exec() call to BLE.connect blocked the main thread for 55ms. Plugin should use CordovaInterface.getThreadPool().\r\n03-17 16:46:34.231 25393-25638/com.xxxxx D/BluetoothGatt: onClientConnectionState() - status=133 clientIf=8 device=D8:80:39:F0:ED:5F\r\n03-17 16:46:34.271 25393-25638/com.xxxxx D/BluetoothGatt: cancelOpen() - device: D8:80:39:F0:ED:5F\r\n03-17 16:46:34.291 25393-25887/com.xxxxx D/BLEPlugin: action = disconnect\r\n03-17 16:46:34.291 25393-25887/com.xxxxx D/BluetoothGatt: cancelOpen() - device: D8:80:39:F0:ED:5F\r\n03-17 16:46:34.301 25393-25638/com.xxxxx D/BluetoothGatt: close()\r\n03-17 16:46:34.301 25393-25638/com.xxxxx D/BluetoothGatt: unregisterApp() - mClientIf=8\r\n03-17 16:46:34.321 25393-25887/com.xxxxx E/PluginManager: Uncaught exception from plugin\r\n                                                              java.lang.NullPointerException: Attempt to invoke virtual method 'void android.bluetooth.BluetoothGatt.close()' on a null object reference\r\n                                                                  at com.megster.cordova.ble.central.Peripheral.disconnect(Peripheral.java:89)\r\n                                                                  at com.megster.cordova.ble.central.BLECentralPlugin.disconnect(BLECentralPlugin.java:353)\r\n                                                                  at com.megster.cordova.ble.central.BLECentralPlugin.execute(BLECentralPlugin.java:166)\r\n                                                                  at org.apache.cordova.CordovaPlugin.execute(CordovaPlugin.java:117)\r\n                                                                  at org.apache.cordova.CordovaPlugin.execute(CordovaPlugin.java:98)\r\n                                                                  at org.apache.cordova.PluginManager.exec(PluginManager.java:132)\r\n                                                                  at org.apache.cordova.CordovaBridge.jsExec(CordovaBridge.java:57)\r\n                                                                  at org.apache.cordova.engine.SystemExposedJsApi.exec(SystemExposedJsApi.java:41)\r\n                                                                  at org.chromium.base.SystemMessageHandler.nativeDoRunLoopOnce(Native Method)\r\n                                                                  at org.chromium.base.SystemMessageHandler.handleMessage(SystemMessageHandler.java:41)\r\n                                                                  at android.os.Handler.dispatchMessage(Handler.java:102)\r\n                                                                  at android.os.Looper.loop(Looper.java:158)\r\n                                                                  at android.os.HandlerThread.run(HandlerThread.java:61)\r\n03-17 16:46:34.321 25393-25393/com.xxxxx D/SystemWebChromeClient: file:///android_asset/www/build/main.js: Line 44325 : connect error\r\n03-17 16:46:34.321 25393-25393/com.xxxxx I/chromium: [INFO:CONSOLE(44325)] \"connect error\", source: file:///android_asset/www/build/main.js (44325)\r\n```\r\nChrome:\r\n```\r\nerrorMessage: \"Peripheral Disconnected\"\r\nid: \"D8:80:39:F0:ED:5F\"\r\nname: \"XXXXX\"\r\n```\r\n\r\nCode\r\n```\r\nscanDevices(){\r\n\tlet that = this;\r\n\r\n\treturn new Promise((resolve, reject) => {\r\n\t\tthat.discoveredDevices = [];\r\n\t\tthat.disconnectDevice();\r\n\r\n\t\tBLE.startScanWithOptions([], { reportDuplicates: false }).subscribe((discoveredDevice: any) => {\r\n\t\t\tthat.discoveredDevices.push(discoveredDevice);\r\n\t\t}, (error: any) => {\r\n\t\t\tconsole.log('scan error', error);\r\n\t\t});\r\n\r\n\t\tsetTimeout(() => {\r\n\t\t\tBLE.stopScan();\r\n\t\t\tresolve(that.discoveredDevices);\r\n\t\t}, 5000);\r\n\t});\r\n}\r\n\t\r\nconnectDevice(selectedDevice: any){\r\n\tlet that = this;\r\n\r\n\treturn new Promise((resolve, reject) => {\r\n\t\tBLE.connect(selectedDevice.id).subscribe((peripheralData: any) => {\r\n\t\t\tconsole.log('connect success', peripheralData);\r\n\t\t\tthat.connectedDevice = peripheralData;\r\n\t\t\tresolve();\r\n\t\t}, (error: any) => {\r\n\t\t\tconsole.log('connect error', error);\r\n\t\t\tthat.disconnectDevice();\r\n\t\t\treject();\r\n\t\t});\r\n\t});\r\n}\r\n```\r\n\r\nDo you know what could cause this problem? Thanks in advance!"}}
{"actor":{"display_login":"don"}}