Disable Status Bar Click and Pull‑Down on Android
In this article
Yes, you can prevent the Android status bar from reacting to taps or pull‑down gestures, but it requires either using the official device‑owner API or enabling a full‑screen immersive mode that hides the bar; there is no simple toggle in the standard Settings app.
What You'll Need
- An Android device running Android 9 (Pie) or later for the DevicePolicyManager method, or Android 4.4+ for immersive mode.
- Access to a computer with Android Studio or the Android SDK platform‑tools installed.
- USB debugging enabled on the device (Settings > Developer options > USB debugging).
- If you want a permanent solution for a single device, you will need to make the app a device owner (kiosk or enterprise use case). This can be done via ADB for testing.
- Basic knowledge of Java/Kotlin and Android project structure (for the code‑based approach).
Step‑By‑Step
- Set up a test project. Open Android Studio, create a new project, and add a
DeviceAdminReceiversubclass. Example in Kotlin:
Register it in theclass KioskAdminReceiver : DeviceAdminReceiver()AndroidManifest.xmlwith the required permission:
The<receiver android:name=".KioskAdminReceiver" android:permission="android.permission.BIND_DEVICE_ADMIN"> <meta-data android:name="android.app.device_admin" android:resource="@xml/kiosk_admin"/> <intent-filter> <action android:name="android.app.action.DEVICE_ADMIN_ENABLED"/> </intent-filter> </receiver> <uses-permission android:name="android.permission.DISABLE_STATUS_BAR"/>@xml/kiosk_adminfile can be a simple empty<device-admin>tag. - Make the app a device owner. For a test device you can use ADB:
This command only works on a device that has been factory reset and has no existing device owner. If the command fails, reset the device and try again.adb shell dpm set-device-owner com.yourpackage/.KioskAdminReceiver - Disable the status bar. In your main activity (or a service that runs continuously), obtain the
DevicePolicyManagerand callsetStatusBarDisabled(true):val dpm = getSystemService(Context.DEVICE_POLICY_SERVICE) as DevicePolicyManager dpm.setStatusBarDisabled(componentName, true)componentNameis theComponentNameof yourKioskAdminReceiver. The call will silently hide the bar and ignore any click or swipe attempts. - Enable immersive full‑screen mode (optional but recommended). Even with the status bar disabled, some OEM skins still show a thin navigation strip. Add the following flags to your activity:
This forces the content to occupy the whole screen and prevents accidental reveals.window.decorView.systemUiVisibility = ( View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY or View.SYSTEM_UI_FLAG_FULLSCREEN or View.SYSTEM_UI_FLAG_HIDE_NAVIGATION) - Test the behaviour. Run the app, then try tapping the top edge or swiping down. The bar should stay hidden and no notification shade should appear. If a swipe temporarily reveals the bar, press the back button or tap the centre of the screen to hide it again.
- Re‑enable the bar when needed. Call the same method with
false:
This is useful for maintenance windows or when you want to hand the device back to a regular user.dpm.setStatusBarDisabled(componentName, false)
Common Mistakes
- Trying to use
setStatusBarDisabledwithout being a device owner. The call will throw aSecurityExceptionbecause the permission is reserved for device‑owner apps. - Running the ADB command on a device that already has a device owner. Android will refuse to set a second owner, so you must factory‑reset first.
- Confusing the immersive flag with the status‑bar disabling flag. Immersive mode only hides the bar; it does not block the swipe gesture unless you also disable the bar via the device‑owner API.
- Using the global
settings put global policy_control immersive.full=*command on a device without the required privileges. Some OEMs restrict this setting, causing no effect. - Forgetting to add the
DISABLE_STATUS_BARpermission to the manifest. Without it the app will compile but the call will be ignored at runtime.
Tips
- Keep a separate “admin” build variant that includes the device‑owner code. This makes it easy to ship a normal consumer version and a kiosk version from the same code base.
- Test on a secondary device first. If you accidentally lock yourself out of the UI, you can always reboot into safe mode (hold the power button, then long‑press “Power off” and choose “Reboot to safe mode”). Safe mode disables all third‑party apps, letting you remove the device‑owner.
- Combine the status‑bar disabling with
setLockTaskPackagesto force the device into lock‑task (kiosk) mode, which further prevents users from leaving the allowed app. - When using immersive mode, remember to re‑apply the UI flags after any configuration change (e.g., orientation change) because the system may clear them.
- If you need a quick, non‑code solution for a demo, you can use the ADB one‑liner to force immersive mode for the current foreground app:
This works on many stock Android builds but can be overridden by the OEM.adb shell settings put global policy_control immersive.full=*
Troubleshooting
If the status bar still appears after calling setStatusBarDisabled(true):
- Verify that your app is indeed the device owner. Run
adb shell dpm get-device-owner; it should return your package name. - Check the logcat for a
SecurityExceptionindicating a missing permission. - Make sure the device is running Android 9 or newer; earlier versions do not expose the API.
- Confirm that the
DISABLE_STATUS_BARpermission is declared exactly as shown; a typo will cause the system to ignore it.
If immersive mode does not hide the navigation bar:
- Some manufacturers (e.g., Samsung, Xiaomi) add custom gestures that override the standard flags. Look for a device‑specific “Full‑screen gestures” setting and disable it.
- Make sure you set the flags after
setContentView()and after anyWindowInsetsControllercalls for newer APIs.
If you cannot set the device owner via ADB:
- The device must be in a “factory‑reset” state with no existing owner. Perform a full wipe from the recovery menu.
- Some OEMs lock the
dpmcommand behind a “developer mode” flag. Ensure “OEM unlocking” is enabled in Developer options.
When all else fails, reboot the device into safe mode, uninstall the offending app, and try the provisioning steps again.
Frequently Asked Questions
Can I disable the status bar without writing any code?
Not through the standard Settings UI. The only officially supported ways are the device‑owner API or immersive‑mode flags, both of which require either code or ADB commands.
Does immersive full‑screen mode block the pull‑down gesture?
Immersive mode hides the bar, but a quick swipe from the top can temporarily reveal it. To completely block the gesture you need setStatusBarDisabled(true) from a device‑owner app.
Will disabling the status bar also hide notifications?
Yes. When the bar is disabled, the notification shade cannot be opened, so notifications are not visible until you re‑enable the bar.
Is root access required?
No. The device‑owner method works on unrooted devices as long as your app is provisioned as the device owner. The global ADB setting for immersive mode works without root on many stock builds, but some OEMs may block it.
Can I re‑enable the status bar later without reinstalling the app?
Absolutely. Call setStatusBarDisabled(componentName, false) at any time. You can also provide a hidden “admin exit” button that triggers this call.
Does this work on all Android versions?
The setStatusBarDisabled method is available from Android 9 (API 28) onward. Immersive‑mode flags have been supported since Android 4.4 (API 19), but OEM customisations may affect their reliability on older devices.