Skip to content Skip to sidebar Skip to footer

Disable Recent Tasks Button On Android 5.0

I am working on an application that needs to suppress the recent apps button as it is done in the Toddler Lock application. What I want is user should not be able to exit my applic

Solution 1:

Finally I was able to achieve this by following:

@OverrideprotectedvoidonPause() {
super.onPause();

ActivityManageractivityManager= (ActivityManager) getApplicationContext()
        .getSystemService(Context.ACTIVITY_SERVICE);

activityManager.moveTaskToFront(getTaskId(), 0);

}

will need permission ...

<uses-permissionandroid:name="android.permission.REORDER_TASKS" />

Solution 2:

You have to write a service which will continuously monitor the top activity. If the top activity is from the package com.android.systemui means the user pressed the recent apps button. So at this time you have maintain the top activity from your application and start the same activity again.

Post a Comment for "Disable Recent Tasks Button On Android 5.0"