AppLocker
AppLocker copied to clipboard
App Locker not working properly in Andriod 10 goes behind app
Applocker not working applocker goes on background
e.g when you open facebook app app locker shows first but facebook goes on top of it making it useless please help
private fun getForegroundObservableHigherLollipop(): Flowable<String> {
return Flowable.interval(250, TimeUnit.MILLISECONDS)
.filter { PermissionChecker.checkUsageAccessPermission(context) }
.map {
val mUsageStatsManager =
context.getSystemService(Service.USAGE_STATS_SERVICE) as UsageStatsManager
val time = System.currentTimeMillis()
val usageEvents =
mUsageStatsManager.queryUsageStats(INTERVAL_DAILY, time - 1000 * 10, time)
val sortedUsageEvents = usageEvents.sortedBy { it.lastTimeUsed }
val usageEvent = sortedUsageEvents.lastOrNull()
UsageEventWrapper(usageEvent)
}
.filter { it.usageEvent != null }
.map { it.usageEvent }
.filter { it.packageName != null }
.filter {
it.packageName.contains(OverlayValidationActivity::class.java.simpleName).not()
}
.map { it.packageName }
.distinctUntilChanged()
}
Update this code