问题
I have an Android app which interacts with custom BLE devices. This app works as expected on devices which have android version 4.4 to 6.0. Now I want to make this available on Chromebooks through the Google Playstore on Chromebooks(App Runtime for Chrome).
I installed this app on my Google Asus Flip Chromebook(Chrome OS version 55, ARC version 3617689) by sideloading the APK onto it. But it is not working as expected.
These are the steps I took:
- Call a startLeScan() which gives the BluetoothDevice as a scanResult.
- Call the connectGatt() method, and the device is connected and in the onConnectionStateChange() callback, get a handle to the BluetoothGatt.
- Call the discoverServices.
- After that, the onServicesDiscovered() callback is hit as expected with status = GATT_SUCCESS. However gatt.getServices returns an empty list when running on Chromebook. When running on Android device (API 19 to API23) I get BluetoothGattService handles to all the services supported by my BLE device.
Which leads me to suspect the BLE implementation on ARC on Chromebook. Has anybody else faced this issue? Is anyone using Android BLE APIs on Chrome OS?
回答1:
I've having the same trouble, and it appears to be a deficiency with the BLE implementation on Chromebooks. Although there isn't a fix or workaround, the issue is being tracked at https://bugs.chromium.org/p/chromium/issues/detail?id=722987
来源:https://stackoverflow.com/questions/41972045/android-app-which-interacts-with-ble-devices-not-working-on-chromebook