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 app
Finally I was able to achieve this by following:
@Override
protected void onPause() {
super.onPause();
ActivityManager activityManager = (ActivityManager) getApplicationContext()
.getSystemService(Context.ACTIVITY_SERVICE);
activityManager.moveTaskToFront(getTaskId(), 0);
}
will need permission ...
<uses-permission android:name="android.permission.REORDER_TASKS" />
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.