Failing to startNotifications and send some writes in a specific phone (works in most phones and some writes also work in the phone with the issue)
See original GitHub issueHi,
First thanks for this plugin!
I’m having a peculiar issue, so I after connecting to my device I need to startNotifications for a specific service and also do some writes for some services, this is all working fine in most phones where we tested (all bellow Android 10 as far as I’m aware, and iPhones)… But in a One Plus phone with Android 12 it’s failing to startNotifications and failing to send a specific write request, there are some that are working, resolving in Characteristic not found
, I’ve been doing some research and just can’t pin point it. It’s weird that it works with most phones and only some cases fail for this phone (although always the same ones).
Using version 1.5.0 of your plugin.
Do you have any idea of what I can do to resolve this? If you need anymore information I can try to provide it.
-
@capacitor-community/bluetooth-le: [e.g. 1.5.0]
-
OS: Android
-
Version 12
Cheers.
Issue Analytics
- State:
- Created a year ago
- Comments:6 (1 by maintainers)
Top GitHub Comments
Hi,
i also encountered this issue and figured out that this issue happens on almost every Xiaomi or Motorola device which are on Android 12 or higher. Tested this on several devices from my colleagues.
So the BLE discovery works, but while calling
startNotifications
this will be thrown:Works on iOS and also on a Google Pixel 4a and some Samsung devices with Android 11 and 12 though…
Unfortunately i don’t have a Xiaomi or Motorola device at home atm to go futher reproducing this behavior, but maybe this information helps a bit.
On my app I experienced something very similar. Two phones with Android 12 (Xiaomi Mi 10T Lite and an other one which name I don’t know) had connection problems. Digging deeper it seemed like the call to
getServices()
right afterconnect()
returned no services for these specific phones, which is necessary forstartNotifications()
.After I read this I tested what happens if I add a 0.5s delay between
connect()
andgetServices()
. With this delaygetServices()
finally returns services and everything works fine now.