Disable recent tasks button on Android 5.0

后端 未结 2 1271
广开言路
广开言路 2021-01-23 14:04

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

2条回答
  •  暖寄归人
    2021-01-23 14:30

    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 ...

    
    

提交回复
热议问题