App stops scanning just when screen is locked. It wakes up after 15min with the periodic job
See original GitHub issueExpected behavior
The app should continue scanning for 15minutes after going to background or locking the screen.
Actual behavior
When the app goes to background or the screen is locked, the app stops scanning inmediately. The scanning job fires after the 15 minute period
Steps to reproduce this behavior
Open the app in foreground, the scanning process is done. Then lock the screen or send the app to background without closing it, the scanning process stops inmediately.
Mobile device model and OS version
Huawei P Smart Android 8.0.0
Android Beacon Library version
2.13.1
I’m using BackgroundPowerSaveMode, just in case it affects or changes the behaviour.
This is the log that I’ve been able to catch with beaconManager.setDebug(true):
04-04 12:45:50.760 4116-4116/ D/ScanJobScheduler: Not scheduling an immediate scan because we are in background mode. Cancelling existing immediate scan.
04-04 12:45:50.761 4116-4116/ I/ScanJob: Using immediateScanJobId from manifest: 208352939
04-04 12:45:50.763 4116-4116/ I/ScanJob: Using periodicScanJobId from manifest: 208352940
04-04 12:45:50.763 4116-4116/ D/ScanJobScheduler: Scheduling ScanJob (job:208352940/<mypackage>/org.altbeacon.beacon.service.ScanJob) to run every 310000 millis
04-04 12:45:50.772 4116-5146/ D/ScanHelper: Beacon packet detected for: id1: 0040c159-12f6-4fc3-9189-87c069ffe5cf id2: 5 id3: 1 with rssi -60
beacon detected : id1: 0040c159-12f6-4fc3-9189-87c069ffe5cf id2: 5 id3: 1
04-04 12:45:50.784 4116-5146/ D/ScanHelper: looking for ranging region matches for this beacon
This region (id1: 0090c159-12f6-4fc3-9189-87c069ffe5cf id2: null id3: null) does not match beacon: id1: 0040c159-12f6-4fc3-9189-87c069ffe5cf id2: 5 id3: 1
04-04 12:45:50.785 4116-5146/ D/ScanHelper: This region (id1: 0070c159-12f6-4fc3-9189-87c069ffe5cf id2: null id3: null) does not match beacon: id1: 0040c159-12f6-4fc3-9189-87c069ffe5cf id2: 5 id3: 1
This region (id1: 0060c159-12f6-4fc3-9189-87c069ffe5cf id2: null id3: null) does not match beacon: id1: 0040c159-12f6-4fc3-9189-87c069ffe5cf id2: 5 id3: 1
This region (id1: 0080c159-12f6-4fc3-9189-87c069ffe5cf id2: null id3: null) does not match beacon: id1: 0040c159-12f6-4fc3-9189-87c069ffe5cf id2: 5 id3: 1
This region (id1: 00a0c159-12f6-4fc3-9189-87c069ffe5cf id2: null id3: null) does not match beacon: id1: 0040c159-12f6-4fc3-9189-87c069ffe5cf id2: 5 id3: 1
This region (id1: 00b0c159-12f6-4fc3-9189-87c069ffe5cf id2: null id3: null) does not match beacon: id1: 0040c159-12f6-4fc3-9189-87c069ffe5cf id2: 5 id3: 1
This region (id1: 0050c159-12f6-4fc3-9189-87c069ffe5cf id2: null id3: null) does not match beacon: id1: 0040c159-12f6-4fc3-9189-87c069ffe5cf id2: 5 id3: 1
04-04 12:45:50.786 4116-5146/ D/ScanHelper: This region (id1: 00c0c159-12f6-4fc3-9189-87c069ffe5cf id2: null id3: null) does not match beacon: id1: 0040c159-12f6-4fc3-9189-87c069ffe5cf id2: 5 id3: 1
This region (id1: 00d0c159-12f6-4fc3-9189-87c069ffe5cf id2: null id3: null) does not match beacon: id1: 0040c159-12f6-4fc3-9189-87c069ffe5cf id2: 5 id3: 1
matches ranging region: id1: 0040c159-12f6-4fc3-9189-87c069ffe5cf id2: null id3: null
04-04 12:45:50.788 4116-4116/ D/CycledLeScannerForLollipop: got record
04-04 12:45:50.789 4116-4116/ I/ScanJob: Using periodicScanJobId from manifest: 208352940
********* Here I locked the screen **************
onStopJob called for immediate scan org.altbeacon.beacon.service.ScanJob@b9cc647
04-04 12:45:50.789 4116-4116/ D/CycledLeScanner: stop called
disabling scan
04-04 12:45:50.790 4116-4116/ D/CycledLeScanner: Done with scan cycle
04-04 12:45:50.790 4116-5139/ D/CycledLeScannerForLollipop: Stopping LE scan on scan handler
04-04 12:45:50.790 4116-4116/ D/ScanHelper: Calling ranging callback
04-04 12:45:50.792 4116-4116/ D/ScanHelper: Calling ranging callback
04-04 12:45:50.792 4116-4116/ D/ScanHelper: Calling ranging callback
04-04 12:45:50.792 4116-4116/ D/ScanHelper: Calling ranging callback
04-04 12:45:50.792 4116-4116/ D/ScanHelper: Calling ranging callback
04-04 12:45:50.792 4116-4116/ D/ScanHelper: Calling ranging callback
04-04 12:45:50.792 4116-4116/ D/ScanHelper: Calling ranging callback
04-04 12:45:50.792 4116-4116/ D/ScanHelper: Calling ranging callback
04-04 12:45:50.792 4116-4116/ D/ScanHelper: Calling ranging callback
04-04 12:45:50.793 4116-4116/ D/ScanHelper: Calling ranging callback
04-04 12:45:50.793 4116-4116/ D/CycledLeScanner: Scanning disabled.
04-04 12:45:50.793 4116-4116/ D/CycledLeScanner: cancel wakeup alarm: PendingIntent{9d57fe3: android.os.BinderProxy@ff1d817}
04-04 12:45:50.797 4116-4116/ D/CycledLeScanner: Set a wakeup alarm to go off in 9223372036233392399 ms: PendingIntent{9d57fe3: android.os.BinderProxy@ff1d817}
Stopping scanning previously left on.
stopping bluetooth le scan
04-04 12:45:50.797 4116-4116/ D/CycledLeScannerForLollipop: Stopping scan
04-04 12:45:50.798 4116-4116/ D/CycledLeScanner: Destroying
04-04 12:45:50.798 4116-4116/ D/ScanJob: Scanning stopped
04-04 12:45:50.798 4116-5139/ D/CycledLeScannerForLollipop: Stopping LE scan on scan handler
04-04 12:45:50.798 4116-4116/ D/ScanJob: Checking to see if we need to start a passive scan
04-04 12:45:50.798 4116-4116/ I/ScanJob: We are inside a beacon region. We will not scan between cycles.
04-04 12:45:50.800 4116-5139/ D/BluetoothLeScanner: could not find callback wrapper
04-04 12:45:50.800 4116-5139/ D/CycledLeScanner: Quitting scan thread
Issue Analytics
- State:
- Created 5 years ago
- Comments:8 (4 by maintainers)
Top Results From Across the Web
Windows 10 computer keeps randomly going to lock screen.
When the computer is IN USE the screen goes black then goes back to the lock screen and requires the passcode again.
Read more >Scanning vs Refreshing a Library - Support - Plex
Scanning and refreshing a library both have to do with getting content into the library. They're different—but related—functions. Scan Library ...
Read more >FAQ | Frequently asked questions - GovernmentJobs
What is the Close Date on a job posting? A closing date is when a job posting no longer accepts applications.
Read more >Understanding Sleep Mode - VisibleTesla
When the app is in sleep mode, it checks the car periodically to see if it is awake. This check will not wake...
Read more >Define work requests | Android Developers
An execution time quota applies only when your app is in the background, ... is an example of periodic work that can run...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Yes, I think two enhancements to Android background scanning are on the table:
Allow foreground scanning intervals to continue for a period of time after the app transitions to the background.
Allow scan periods more frequent than 15 minutes in the background by use of a foreground service.
@Eylen, if you think the first enhancement would resolve this issue, I will create a new issue specifically for that enhancement and close this issue referencing the new one.
See proposed solution in #717