You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
Calling stopLEScan() when no BleAdapter state is OFF crashes with IllegalStateException
To Reproduce
Create script which calls BleClient.requestLEScan()
Add BleClient.stopLEScan(); in a timeout or call it manually
I was not able to reproduce this myself but got crash logs from different devices in Android Play console; unfortunately no user reports 😢
See below for devices and crash logs
Expected behavior
Call to stopLEScan() will not cause an error
Screenshots
If applicable, add screenshots to help explain your problem.
Plugin version:
@capacitor-community/bluetooth-le: 1.8.0
Desktop (please complete the following information):
N/A
Smartphone (please complete the following information):
Device: Motorola edge 20 /Fairphone3
OS: Android 11 / Android 12
Browser: System WebView
Version N/A
Additional context
Full crash report (Motorola device, Android 11):
java.lang.RuntimeException:
at com.getcapacitor.Bridge.lambda$callPluginMethod$0$com-getcapacitor-Bridge (Bridge.java:601)
at com.getcapacitor.Bridge$$ExternalSyntheticLambda5.run (Unknown Source:8)
at android.os.Handler.handleCallback (Handler.java:938)
at android.os.Handler.dispatchMessage (Handler.java:99)
at android.os.Looper.loop (Looper.java:250)
at android.os.HandlerThread.run (HandlerThread.java:67)
Caused by: java.lang.reflect.InvocationTargetException:
at java.lang.reflect.Method.invoke (Native Method)
at com.getcapacitor.PluginHandle.invoke (PluginHandle.java:121)
at com.getcapacitor.Bridge.lambda$callPluginMethod$0$com-getcapacitor-Bridge (Bridge.java:592)
Caused by: java.lang.IllegalStateException:
at android.bluetooth.le.BluetoothLeUtils.checkAdapterStateOn (BluetoothLeUtils.java:177)
at android.bluetooth.le.BluetoothLeScanner.stopScan (BluetoothLeScanner.java:285)
at com.capacitorjs.community.plugins.bluetoothle.DeviceScanner.stopScanning (DeviceScanner.kt:138)
at com.capacitorjs.community.plugins.bluetoothle.BluetoothLe.stopLEScan (BluetoothLe.kt:356)
I can submit a PR with the following code if you agree this would be a good solution:
Describe the bug
Calling
stopLEScan()
when no BleAdapter state is OFF crashes withIllegalStateException
To Reproduce
BleClient.requestLEScan()
BleClient.stopLEScan();
in a timeout or call it manuallyI was not able to reproduce this myself but got crash logs from different devices in Android Play console; unfortunately no user reports 😢
See below for devices and crash logs
Expected behavior
Call to
stopLEScan()
will not cause an errorScreenshots
If applicable, add screenshots to help explain your problem.
Plugin version:
Desktop (please complete the following information):
Smartphone (please complete the following information):
Additional context
Full crash report (Motorola device, Android 11):
I can submit a PR with the following code if you agree this would be a good solution:
In
BluetoothLe.kt
, line 353:The text was updated successfully, but these errors were encountered: