I'm developing a Home Application for Android devices. I want to disable long press home button action of recent App. I googled and found some solution but didn't get the solution I want. Right now I'm using this piece of code. It worked, disable Home button recent app but It also closed any other app launch by user.
@Override
public void onWindowFocusChanged(boolean hasFocus) {
super.onWindowFocusChanged(hasFocus);
if (!hasFocus) {
Toast.makeText(staticPosContext, "No Focus", Toast.LENGTH_SHORT)
.show();
ActivityManager am = (ActivityManager) getSystemService(Context.ACTIVITY_SERVICE);
am.moveTaskToFront(getTaskId(), ActivityManager.MOVE_TASK_WITH_HOME);
sendBroadcast(new Intent(Intent.ACTION_CLOSE_SYSTEM_DIALOGS));
}
}