Unable to write to characteristic via Chrome browser on Android 10

583 Views Asked by At

I am using Web Bluetooth API to write to a characteristic of a PCB board. I am able to successfully write to the characteristic via Chrome on Windows laptop.

If i try the same code via Chrome on Android 10, I get a DOM Exception: GATT Error Unknown.

I am writing a Uint8Array of length 493. I tried writing the entire data and also in chunks of 10. In both cases, I am getting an error in Mobile device.

Can someone please help?

I am using Chrome browser version 91.

UPDATE: Added Code Snippet. I am calling a Python API to fetch data to be written to the characteristic and converting the data to Uint8Array. I tried to write the entire data via mobile but it wasn't working. Found this link which says to write data in chunks. So I tried that as well. Still same error.

enter image description here

UPDATE 2: I tried the methods writeValue and writeValueWithoutResponse. I am getting GATT server disconnected error. I tried this link to try to fix the same. But it still persists. I have attached the screenshot for the same. enter image description here

UPDATE 3: I tried with adding an event listener. I tried the same code from laptop and mobile device. It works on laptop successfully and gives off error on mobile. I have attached screenshots for both laptop and mobile. enter image description here

enter image description here

1

There are 1 best solutions below

0
On

To get help you likely need to reduce the problem to simple code samples that you can share. Ideally these work with common devices that others can test too.

https://www.chromium.org/developers/how-tos/file-web-bluetooth-bugs includes tips on how to capture logs and test with other devices.