AltBeacon / android-beacon-library

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

Samsung devices not detecting beacons by intent after first screen off #1187

Open davidgyoung opened 5 months ago

davidgyoung commented 5 months ago

Expected behavior

Apps using the library's IntentScanStrategy will continue to detect beacons after the screen is turned off.

Actual behavior

After first launch of the app and the subsequent screen turn off, beacon detections stop. They resume as soon as the screen is illuminated again.

Steps to reproduce this behavior

  1. Install the Kotlin Beacon Reference App (modified to use the IntentScanStrategy) on A Samsung Device with Android 14
  2. Grant all permissions
  3. Turn on a 10Hz beacon transmitter and ensure beacons are detected in the foreground.
  4. Watch logicat filtering for BroadcastRecevier, seeing multiple detections get delivered to the reference app per second.
  5. Turn the screen off. See that detections stop in a few seconds.
  6. Wait 30 seconds or more and confirm no further detections are seen
  7. Turn the screen on, see that detections resume.
  8. Turn the screen off, see that detections continue (at a slower rate)

Mobile device model and OS version

Samsung Galaxy S23 Android 14 Samsung Galaxy Tab 8 Android 14

Android Beacon Library version

2.20.4

This same problem was not witnessed on earlier Samsung OS versions and Pixel devices:

Samsung Galaxy A10 Android 11 (detections continue with screen off at 5-10 Hz) Samsung Galaxy S23 Android 13 (detections continue with screen off at 3/sec) Google Pixel 4a Android 14 (detections continue with screen off at 0.1 Hz)

It is unclear whether this is an Samsung bug for an intentional change.

No meaningful log lines are visible at a system level when this happens.

devirtua commented 2 months ago

Exactly same problem here Realme GT2 Android 14 Android Beacon Library 2.20.6