In a small team we're developing an application that is deployed to both Android (Tablets) and ChromeOS devices. For this, we have a couple build targets such as Pixel C's, Galaxy Tabs, an Asus C302 Chromebook and a Pixelbook.
The App we're developing interfaces over BLE with a Windows 10 system that runs an application that accepts incoming BLE connections. What we perform in our App:
We perform a scan to find a device with a specific name
We connect to this device: using the Android Native BluetoothDevice class: mBluetoothDevice.connectGatt();
We request the services: using the Android Native BluetoothGatt class: mBluetoothGatt.discoverServices();
When our App is deployed to Android targets, it successfully connects to the W10 app and retrieves its services (onServicesDiscovered).
However, when the same builds of the App are ran on ChromeOS, the following exception is thrown for retrieving services:
08-17 10:46:52.750 3827-3846/com.(our namespace) D/TheApp: BleGattHandler | onServicesDiscovered() called with: gatt = [android.bluetooth.BluetoothGatt#baff2ee], status = [0]
08-17 10:46:52.751 3827-3846/com.(our namespace) W/BluetoothGatt: Unhandled exception in callback
java.lang.NullPointerException: Attempt to invoke virtual method 'android.bluetooth.BluetoothGattCharacteristic android.bluetooth.BluetoothGattService.getCharacteristic(java.util.UUID)' on a null object reference
at com.(our namespace).communication.bluetooth.lowenergy.BleGattHandler.onServicesDiscovered(BleGattHandler.java:90)
at android.bluetooth.BluetoothGatt$1.onSearchComplete(BluetoothGatt.java:237)
at android.bluetooth.IBluetoothGattCallback$Stub.onTransact(IBluetoothGattCallback.java:103)
at android.os.Binder.execTransact(Binder.java:565)
Our conclusion is that for some reason, ChromeOS fails to retrieve the services of a BLE device. We're at a loss here and hope to hear if anyone of you knows the cause or possible resolution (we're also open to professional help)
What ChromeOS version are we using
Our most recent test (today) was on the Pixelbook with:
ChromeOS 68.0.3440.87 (from beta channel)
ChromeOS 69.0.3497.21 (from dev channel)
What we have found up till now
This ChromeOS issue, yet it is reported Fixed:
https://bugs.chromium.org/p/chromium/issues/detail?id=722987
Android app which interacts with BLE devices not working on Chromebook
Why are we not using 'normal' Bluetooth (classic)?
We're currently using a C# W10 App to connect to using the App. However, this application serves as a Stub for now and will in the near future be replaced by a low-power embedded solution (wearable product) we are developing that requires operation over BLE. We're therefore bound to use BLE.
Related
I am working on a simple web application that sends commands to an HC-06 Bluetooth module using Web Bluetooth API. So far, I have successfully connected the device to the browser and gained access to the server, service, and characteristics. The problem starts when I try to do anything after that point. Reading or writing to the HC-06 throws DOMException: GATT operation not permitted.
I logged characteristic.properties (in the fourth promise chain) and seem to have found the problem. BluetoothCharacteristicProperties is the following object:
{
authenticatedSignedWrites: false
broadcast: false
indicate: false
notify: true
read: false
reliableWrite: false
writableAuxiliaries: false
write: false
writeWithoutResponse: false
}
So, it makes sense that I can not perform any operations on the module. What I don't understand is why the permissions are set to false. I already have a working Python application that perfectly communicates with the same HC-06 - and I can send commands to it through an Android terminal. This leads me to believe there is some misconfiguration I've overlooked in the web app implementation. Is there a way to change these permissions through the Web Bluetooth API? Or perhaps through AT commands to the module itself? Or maybe the API simply won't work with this model? Any help would be appreciated!
Thanks to #nondebug for the help! Turns out there is a lot of distinction between Bluetooth modules. The HC-06 that I'm using for this project is running Bluetooth 2.0, and the Web Bluetooth API requires Bluetooth 4.0 and above. I was able to write some Javascript using the Web Serial API instead, and can make a connection to my device using a desktop browser. Unfortunately, mobile browsers do not seem to support Web Serial API. Time to get started on a native app I guess!
You are writing to the wrong GATT service characteristic.
Notify and read on characteristic 0xFFE1.
Writing on characteristic 0xFFE2.
Got it working: ble on HC-06.
Its a strang chinese clone.
I used Bluetooth LE Explorer.
Installed from the MS Store.
Connect TX and RX together.
Set "Notify" and "Use Windows Notifications" on for characteristic 0xFFE1
Write value (UTF8) for characteristic 0xFFE2
Data you write show-up in the Windows Notification window.
A question about registering BLE notification on android:
I am developing an app that once the android device detects our beacon/ble hardware, should write something to one of the writable characteristics of that hardware.
Trying to understand, on the android app side how can I register some intent to be called when a ble connection was made to the android framework.
since a broadcast receiver registered in manifest can no longer launch my app and android background services policy was changed, this can't be done. so..
I am trying to use JobScheduler which was designed to be launched based on criteria. this can launch a JobService to do the job.
When the app is in foreground or background this seems to be working.
The thing is, I need to be notified when the app is not running (Not even in background)
I used a service in my android app that check SignalR connection state every 10 seconds and if was disconnected, try to init SignalR and make it connected.
But in Android 8 some limitation added (Read more), that kill background services and also we can't call startService method to start service from BroadcastReceiver that detect device boot completed.
What's your best solution to resolve this problem for all Android versions, that is better without any dependency?
When attempting to read Heart Rate Sensor from a Microsoft Band paired with a Raspberry Pi2 running latest Windows IoT Core (10586). I get an exception when calling:
“bandClient.SensorManager.HeartRate.RequestUserConsentAsync()”
It would seem that the IoT Core does not contain the necessary libraries to create the popup dialog that is seen on other devices when executing this method.
Are there plans to extend the Band SDK to support Windows IoT Core in this scenario?
Are there any proposed workarounds?
Thank you,
Paul
Windows 10 IoT is currently not supported by the Microsoft Band SDK. In particular, the user consent prompts run on the device that the band is paired with and in this case the required APIs for user prompts are not supported in the Windows 10 IoT Core APIs.
If you require this in a future release of the SDK please open a request at the Microsoft Health User Voice page https://microsofthealth.uservoice.com
This question is regarding file transfer using AllJoyN
I am using the basic_client & basic_service files for Windows 64 Bit desktop machine and I was able to build and run it successfully to transfer files from Client to Service.
Also I am able to transfer files between two phones in Android using the Android sdk with the FIle Transfer sample provided which in turn uses the FileTransferComponent.
Now I am trying to make the discovery part work for the Android devices and the Desktop. THe desktop discovers the Android device but the Android device wont discover the desktop client. Could you please let me know what I am doing wrong here?
Also the file transfer modules(Like OfferFile,RequestOffer) are handled by the bus in Android whereas in Windows client, there is a FileTransfer interface implemented for the same to transfer data using input-output stream. Could you please help me understand how I can achieve the same filetransfer between the two clients when their implementation is different? Or should I use a different mechanism for this purpose?
Awaiting your reply