also looking at this
feat(android): the Bluetooth scan pair in Zig — ratchet 56 → 54
#186
7 files
+377
-3
| @@ -2993,6 +2993,11 @@ class CraftBridge( | ||
| 2993 | 2993 | |
| 2994 | 2994 | @JavascriptInterface |
| 2995 | 2995 | fun startBluetoothScan() { |
| 2996 | // The ScanCallback object is CraftNative's, and so are the scanner and | |
| 2997 | // callback fields — which is why stopBluetoothScan has to reach the | |
| 2998 | // same way, or its own fields stay null and stopScan is never called. | |
| 2999 | if (CraftNative.startBluetoothScan(activity)) return | |
| 3000 | ||
| 2996 | 3001 | if (ContextCompat.checkSelfPermission(activity, Manifest.permission.BLUETOOTH_SCAN) |
| 2997 | 3002 | != PackageManager.PERMISSION_GRANTED) { |
| 2998 | 3003 | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) { |
| @@ -3026,6 +3031,8 @@ class CraftBridge( | ||
| 3026 | 3031 | |
| 3027 | 3032 | @JavascriptInterface |
| 3028 | 3033 | fun stopBluetoothScan() { |
| 3034 | if (CraftNative.stopBluetoothScan(activity)) return | |
| 3035 | ||
| 3029 | 3036 | bleScanCallback?.let { bluetoothScanner?.stopScan(it) } |
| 3030 | 3037 | bleScanCallback = null |
| 3031 | 3038 | } |