don / cordova-plugin-ble-central

Bluetooth Low Energy (BLE) Central plugin for Apache Cordova (aka PhoneGap)
Apache License 2.0
941 stars 601 forks source link

startNotification not returning any result for API level 33 (Pixel devices) #1010

Open KumarSunil007 opened 1 month ago

KumarSunil007 commented 1 month ago

I have app which is running fine on 80% of devices but Google Pixel devices and Nokia devices (either Android 12 or 13 or 14), when connect is called, it is asking for Call History permission which is triggering Negative image for the app to the end users.

Also, The startNotification function doesn't provide any response and do nothing on these devices. The function neither returning error no returning Success callback.

Let me know can be done to avoid this Extra permission message and why I am not getting anything for startNotification function.

peitschie commented 1 month ago

The Call History prompt something Android does itself as part of the bonding process. A reasonable overview of this process is recorded here: https://medium.com/@futail2a/why-android-requests-contacts-and-call-history-during-ble-pairing-deb2032c64f5

A few questions:

  1. I presume you have some encrypted characteristics on your Bluetooth device? If not, the first question is why you're getting a pairing request at all
  2. Does startNotification work if you call it after the pairing dialog is accepted?

This is unlikely to be anything related to this plugin however, as what you're running into is native Android behaviour that they don't expose APIs to control.

KumarSunil007 commented 1 month ago

Thanks @peitschie for prompt response. Here is answer for your queries.

  1. When I call the startNotification that time the permission popup is shown and it ask for Pairing. I am not calling pair function anywhere.
  2. After accepting pair request, nothing happen as I am not getting anything inside success or error callback.

I think the broadcast listener is not triggering any even for intent to send data back to callback function.