AltBeacon / android-beacon-library

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

EnableForegroundServiceScanning somtimes return beacon 0 #1064

Closed xzq2325 closed 2 years ago

xzq2325 commented 2 years ago

Expected behavior

Always return the exact number of beacons

Actual behavior

Generally, the correct amount can be returned, and sometimes beacon 0 is returned, and then it has been difficult to recover. Turning on and off the Bluetooth seems to be able to return to normal

Steps to reproduce this behavior

I haven't found the steps to reproduce

Mobile device model and OS version

SEUIC Android 9.0

Android Beacon Library version

2.19.3

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.

I confirm that the Location and Bluetooth switches have been turned on, and the authorization is normal. When this problem occurred, I debugged and found that there was no call onScanResult function In CycledLeScannerForLollipop.java.

davidgyoung commented 2 years ago

You may want to try using the BluetoothMedic class to auto recover from this problem. See: https://stackoverflow.com/a/51450865/1461050

If you find that the above works, then that may be the best we can do here.

If it does not work, then we need to collect more logs at the specific time detections stop, including system level logs. I would recommend setting up a long-term test and sending logcat output to a file, then letting this run for many hours or days until the problem happens.

xzq2325 commented 2 years ago

You may want to try using the BluetoothMedic class to auto recover from this problem. See: https://stackoverflow.com/a/51450865/1461050

If you find that the above works, then that may be the best we can do here.

If it does not work, then we need to collect more logs at the specific time detections stop, including system level logs. I would recommend setting up a long-term test and sending logcat output to a file, then letting this run for many hours or days until the problem happens.

Very thanks for your answer. I will try using the BluetoothMedic class.