Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

App Locker not working properly in Andriod 10 goes behind app #8

Open
blazingdevil44 opened this issue Feb 4, 2021 · 1 comment
Open

Comments

@blazingdevil44
Copy link

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

@aishik212
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants