mirror of
https://codeberg.org/timelimit/opentimelimit-android.git
synced 2025-10-05 02:39:34 +02:00
Improve foreground app detection
This commit is contained in:
parent
b74350f85f
commit
c37b888b56
1 changed files with 3 additions and 1 deletions
|
@ -64,7 +64,9 @@ class LollipopForegroundAppHelper(private val context: Context) : ForegroundAppH
|
||||||
// note: when the duration is too small, Android returns no data
|
// note: when the duration is too small, Android returns no data
|
||||||
// due to that, 1 second more than required is queried
|
// due to that, 1 second more than required is queried
|
||||||
// which seems to provide all data
|
// which seems to provide all data
|
||||||
lastQueryTime - 1000
|
// update: with 1 second, some App switching events were missed
|
||||||
|
// it seems to always work with 1.5 seconds
|
||||||
|
lastQueryTime - 1500
|
||||||
}
|
}
|
||||||
|
|
||||||
usageStatsManager.queryEvents(queryStartTime, now)?.let { usageEvents ->
|
usageStatsManager.queryEvents(queryStartTime, now)?.let { usageEvents ->
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue