disable all home button and task bar features on Nexus 7

前端 未结 3 1039
名媛妹妹
名媛妹妹 2020-12-10 09:35

I am building an app that will form part of an exhibition. It will be displayed on a Nexus 7 which will be securely mounted. The app has touchscreen functionality and will d

3条回答
  •  刺人心
    刺人心 (楼主)
    2020-12-10 10:00

    I may be a bit late.

    But i've found the, in my opinion, best solution for the Recent Apps Button Problem:

    @Override
    public void onWindowFocusChanged(boolean hasFocus) {
        super.onWindowFocusChanged(hasFocus);
        if (&& !hasFocus) {
            // Close every kind of system dialog
            Intent closeDialog = new Intent(Intent.ACTION_CLOSE_SYSTEM_DIALOGS);
            sendBroadcast(closeDialog);
    
            // send task back to front
            ActivityManager activityManager =
                    (ActivityManager) getApplicationContext().getSystemService(Context.ACTIVITY_SERVICE);
            activityManager.moveTaskToFront(getTaskId(), 0);
        }
    }
    

    The "send task back to front" part will prevent the pull down of the Notification bar by simply sending it back up instantly and will close the Recent Apps View. The other one is to close the "Shutdown/Restart" View when he tries to shut down his phone.

    Now Excuse my English and have a nice Day.

    Greetings Jimmy

提交回复
热议问题