2

I am currently developing an app and I would like to have a little more control over it then usual without having to root the device. I would like to remove the capability of the recent apps button in the navigation bar, or at least make it do something else from the default actions. Is there a way to do this? I'm sure there is since SureLock does the same thing. Thanks

I have found a workaround for this on this website:http://www.juliencavandoli.com/how-to-disable-recent-apps-dialog-on-long-press-home-button/ you need to add this permission: android.permission.REORDER_TASKS And add this code:

public void onWindowFocusChanged(boolean hasFocus)
{
    super.onWindowFocusChanged(hasFocus);
    if( !hasFocus)
    {
    ActivityManager am = (ActivityManager)getSystemService(Context.ACTIVITY_SERVICE);
    am.moveTaskToFront(getTaskId(), ActivityManager.MOVE_TASK_WITH_HOME );
    sendBroadcast( new Intent(Intent.ACTION_CLOSE_SYSTEM_DIALOGS) );
    }
}
rstojano
  • 159
  • 4
  • 14
  • See [here](http://stackoverflow.com/questions/16657300/disable-all-home-button-and-task-bar-features-on-nexus-7/16657359#16657359) for solutions to "locking down" Android. – TronicZomB Jun 05 '13 at 19:20
  • Not particularly what I'm looking for. In that solution they say that you cannot override the recent apps button, but I know for a fact that it is possible – rstojano Jun 05 '13 at 19:30
  • http://stackoverflow.com/questions/16326114/android-override-recent-apps-button – TronicZomB Jun 05 '13 at 19:31
  • Other apps have done it before – rstojano Jun 05 '13 at 19:33

2 Answers2

3

It is not possible to override the recent apps button.

There is no KeyEvent like there is for the Back Button, and as such this feature is not available.

See documentation here: http://developer.android.com/reference/android/view/KeyEvent.html

TronicZomB
  • 8,667
  • 7
  • 35
  • 50
0

You may not be able to disable a button, but you can disable the app that is associated with it. I don't know how it is done, but I have seen kiosk app (for non-rooted devices) that disallow other apps from loading.