Skip to content Skip to sidebar Skip to footer

Can I Disable Systemui From Within My Android App?

I used this answer to achieve a Kiosk Mode for my app: https://stackoverflow.com/a/26013850 I rooted the tablet with Kingo Root and then performed the following commands: adb shell

Solution 1:

/**
 * Uses Root access to enable and disable SystemUI.
 * @param enabled Decide whether to enable or disable.
 */
public void setSystemUIEnabled(boolean enabled){
    try {
        Process p = Runtime.getRuntime().exec("su");
        DataOutputStream os = new DataOutputStream(p.getOutputStream());
        os.writeBytes("pm " + (enabled ? "enable" : "disable") 
                + " com.android.systemui\n");
        os.writeBytes("exit\n");
        os.flush();
    } catch (IOException e) {
        e.printStackTrace();
    }
}

Works fine. Usage:

setSystemUIEnabled(true);  // Enable SystemUI
setSystemUIEnabled(false); // Disable SystemUI

Post a Comment for "Can I Disable Systemui From Within My Android App?"