Skip to content

No beacons after locked screen #1174

@juliankotrba

Description

@juliankotrba

Behavior + steps to reproduce this behavior

I am creating this ticket because we experience a weird problem with only one of our test devices (Pixel 7). The issue is one of the classic ones: as soon as we lock the phone and the display goes dark, the ranging stops.

I already tried to change all the different library settings in our app but the behavior stayed the same. To simplify the analysis of the problem for you, I checked out the android-beacon-library-reference-kotlin project (#2aa42a44) and tried to reproduce the problem there, which was actually reproducible. To prove that the problem occurs, I made some small modifications to the project.

  1. I updated the unique region id to match our beacon scheme.

  2. I uncommented the following lines

beaconManager.setBackgroundBetweenScanPeriod(0);
beaconManager.setBackgroundScanPeriod(1100);
  1. I added a beep tone when central ranging observer is called:
...
if (rangeAgeMillis < 10000) {
    val toneGen1 = ToneGenerator(AudioManager.STREAM_MUSIC, 100)
    toneGen1.startTone(ToneGenerator.TONE_CDMA_PIP, 150)
    Log.d(MainActivity.TAG, "Ranged: ${beacons.count()} beacons")
    ...
}
...
  1. I set the debug mode to true and added a custom logger, which is a replica of the VerboseAndroidLogger except that I prefixed the tag with "DEBUG" in order to make it easily filterable in the Logcat.

Then I ran the app on our Pixel 8 (Android 14) and on our Pixel 7. On the Pixel 8, the beeping continued after locking the phone while it stopped on the Pixel 7. I suspect that the problem is due to a device setting, but I haven't been able to identify it yet.

While reading through the GH issues I stumbled across your comment here where you mention three possible reasons why beacons are not detected when the screen is off: #944 (comment)

Ad 1. If the hardware code hasn't been set correctly, this would then lead to problems on different devices right? Since it works on almost all other phones I assume this one is correct.

Ad 2. In case the beacon parser layout is incorrect, I also assume it would also affect other devices.

Ad 3. I uninstalled all BLE scanning apps and tried again, no change in behavior

After the screen becomes active again, the beeping and therefore the ranging starts again.

Mobile device model and OS version

Pixel 7
Android 14
Build number: AP11.231020.016.A1
Security update: 1 November 2023
This devices is enrolled in the beta program

Library Logs:

altbeacon-logs.txt

We would really appreciate it if you could shed some light on this behavior.
Please let me know if any other important information is missing or if there is anything I can assist you with.

Thanks
Julian

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions