0

I am trying to build an android app in kiosk-mode. What I have achieved till now is to make the application as full screen and also handled the home and back buttons. However, my problem is, I want to remove the status/notification bar. I don't want the user to access any other settings through it.

Can anyone please help me on this?

  • [Permanently hide Android Status Bar](http://stackoverflow.com/questions/21371802/permanently-hide-android-status-bar) – Onik Dec 28 '15 at 12:26

1 Answers1

0

You can use immersive mode but that will still allow a user to access the status bar by swiping from the top of the screen 2 times.

What you really want is to run a shell: service call activity 42 s16 com.android.systemui as root.

You can use this function to execute it:

public static void sudo(String...strings) {
    try{
        Process su = Runtime.getRuntime().exec("su");
        DataOutputStream outputStream = new DataOutputStream(su.getOutputStream());

        for (String s : strings) {
            outputStream.writeBytes(s+"\n");
            outputStream.flush();
        }

        outputStream.writeBytes("exit\n");
        outputStream.flush();
        try {
            su.waitFor();
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        outputStream.close();
    }catch(IOException e){
        e.printStackTrace();
    }
}

This was pulled from another S/O question with pages upon pages of answers but it is the only one to work for me on multiple devices. So, just to save you some time.

Aaron Gillion
  • 2,227
  • 3
  • 19
  • 31