AltBeacon / android-beacon-library

Allows Android apps to interact with BLE beacons
Apache License 2.0
2.83k stars 836 forks source link

When monitoring Beacons, sometimes cannot get the BluetoothName. #1032

Closed qsxiaoxiao closed 3 years ago

qsxiaoxiao commented 3 years ago

Expected behavior

Every second when receiving the beacon advertisement package, the program can get all of the information for a beacon.

Actual behavior

When using startRanging function, in onBeaconServiceConnect method, sometimes we can receive the UUID and Major/Minor and Rssi but cannot receive BluetoothName field (BluetoothName == null) for the same beacon. May recover after several seconds or minutes, or when restarting the program.

Steps to reproduce this behavior

Keep scanning the beacons.

Mobile device model and OS version

ViVo Android 10 (all battery savers have been closed)

Android Beacon Library version

2.17.1 IMPORTANT: This forum is reserved for feature requests or reproducible bugs with the library itself. If you need help with using the library with your project, please open a new question on StackOverflow.com.

davidgyoung commented 3 years ago

This is expected behavior. The bluetooth name field is populated by the operating system when it reads a BLE scan response with the name of the device populated. Different BLE peripherals will provide this info in the scan response at different frequencies and different Android devices will process it with different time delays.

Bottom line: it is normal for this value to be null when you first detect a beacon, and it may or may not be populated at a later time.