capacitor-community / bluetooth-le

Capacitor plugin for Bluetooth Low Energy
MIT License
284 stars 86 forks source link

Sometimes the scan does not return localName and device.name but only device.deviceId #662

Open emanueletoffolon opened 4 months ago

emanueletoffolon commented 4 months ago

Describe the bug Sometimes the scan does not return localName and device.name but only device.deviceId

To Reproduce Start the scan using requestLEScan with the default options

Smartphone (please complete the following information):

Plugin version:

Has this ever happened to you?

Thanks

pwespi commented 4 months ago

This is expected because not all devices advertise a name.

Do you have a peripheral where you expect a name and don't get one?

emanueletoffolon commented 4 months ago

Yes, sometimes the same device returns the name and deviceId and sometimes just the deviceId. I noticed this by keeping track of the deviceId since on Android it corresponds to the Mac address and never changes unlike on iOS. I tried to do several scanning tests with nRF connect and I didn't encounter this problem, so I decided to write here to ask if anyone has had the same problem.

Thanks

bonatoc commented 2 months ago

@emanueletoffolon I have the same problem under Android. Sometimes it's the ID of the devices, sometimes it's the name (as per BLE GAP). It's inconsistent and I wonder if this has to do with some caches on the Android part regarding "known devices" (but I'm far from being a specialist).

I'm referring to the Android pop-up listing the found devices after a requestLEScan() call.