How to run an Android App in Kiosk Mode, keep Safe Mode disabled and prevent the device from Hard Reset? How to run an Android App in Kiosk Mode, keep Safe Mode disabled and prevent the device from Hard Reset? android android

How to run an Android App in Kiosk Mode, keep Safe Mode disabled and prevent the device from Hard Reset?


100% Kiosk Mode impossible.

Restrict hard reset : The hard reset option is a part of bootloader, so it's hard to prevent device getting factory reset,

I had solution, but only works if the device rooted

Restrict hard reset : copy your apk file to system/app, when device got restored Android will automatically reinstall all apps from system/app folder

Disable System APP : to disable system apps or any apps run a shell command

pm disable <package name>


Interpret Volume Keys : To run this you don't need root access, Use this code in your Activity Class

@Overridepublic boolean onKeyDown(int keyCode, KeyEvent event){    // TODO Auto-generated method stub    if ((keyCode == KeyEvent.KEYCODE_VOLUME_DOWN))    {        // Do what ever you want    }    if ((keyCode == KeyEvent.KEYCODE_VOLUME_UP))    {        // Do what ever you want    }    return true;}

Bonus disable navigation bar and status bar
To Hide

 private void hideNavigationBar(){    try {        Process process = Runtime.getRuntime().exec("su");        DataOutputStream os = new DataOutputStream(process.getOutputStream());        os.writeBytes("pm disable com.android.systemui\n");        os.flush();        try {        Process process = null;        process = Runtime.getRuntime().exec("su");        DataOutputStream osReboot = new DataOutputStream(process.getOutputStream());        osReboot.writeBytes("reboot\n");        osReboot.flush();        process.waitFor();            }             catch (IOException e) {                e.printStackTrace();            }             catch (InterruptedException e) {                e.printStackTrace();            }    }catch (IOException e) {        e.printStackTrace();    }}

Restore back to normal

private void showNavigationBar(){    try {        Process process = Runtime.getRuntime().exec("su");        DataOutputStream os = new DataOutputStream(process.getOutputStream());        os.writeBytes("pm enable com.android.systemui\n");        os.flush();        os.writeBytes("reboot\n");        os.flush();        process.waitFor();    } catch (InterruptedException e) {        e.printStackTrace();    } catch (IOException e) {        e.printStackTrace();    }}

Note : Device will reboot after running shell commands

Your playing with root, so you and your own, If any doubt please command before start coding


Take a look at Android Management API, seems more can't be done without custom device firmware.


Can you design and then deploy your app as DeviceOwner? This gives you the greatest possibilities on the device, but deployment can be painful depending on the context: not suitable for a public release, but doable if you can manage the devices fleet.