Many businesses, schools, or hobbyists need a single‑purpose Android device that runs only a specific app (or a small set of apps). Android’s device‑owner mode, combined with lock‑task (kiosk) APIs, lets you lock down the device without rooting or flashing a custom ROM. The result is a self‑contained, tamper‑resistant terminal that can be handed to anyone while keeping the underlying system safe.
What this tutorial covers: enabling device‑owner mode via ADB, configuring lock‑task mode, whitelisting apps, handling common pitfalls, and restoring the device to normal operation.
adb installed. You can get the platform‑tools zip from the Android developer site and add it to your PATH.adb backup or your preferred method) is recommended in case you need to revert.Android’s lock‑task mode can only be started by an app that has been granted the appropriate permission. You have two options:
android:lockTaskMode="if_whitelisted" in its manifest (e.g., many digital signage or POS apps).public class KioskActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// Hide system UI
getWindow().getDecorView().setSystemUiVisibility(
View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY |
View.SYSTEM_UI_FLAG_HIDE_NAVIGATION |
View.SYSTEM_UI_FLAG_FULLSCREEN);
// Start lock‑task mode
startLockTask();
}
}
Make sure the manifest contains:
<activity android:name=".KioskActivity"
android:lockTaskMode="if_whitelisted" />
For the purpose of this guide we will assume you have an APK called com.example.kiosk.apk ready to install.
adb devices
You should see a device ID with the word device next to it.
adb install -r com.example.kiosk.apk
The -r flag replaces any existing version.
If the installation fails with INSTALL_FAILED_INSUFFICIENT_STORAGE, clear some space or move media to an SD card before proceeding.
Only the device‑owner can enable lock‑task mode without user interaction. The Android system provides a special ADB command for this purpose. Important: The device must be in a factory‑reset state for the command to succeed. However, Android 9 (API 28) introduced a “test‑only” flag that works on a non‑reset device, which we will use.
com.example.kiosk).adb shell dpm set-device-owner com.example.kiosk/.MyDeviceAdminReceiver
Here .MyDeviceAdminReceiver is a broadcast receiver declared in the app’s manifest as a device_admin component. If you used the simple placeholder app, add this receiver:
<receiver android:name=".MyDeviceAdminReceiver"
android:permission="android.permission.BIND_DEVICE_ADMIN">
<meta-data android:name="android.app.device_admin"
android:resource="@xml/device_admin_receiver" />
<intent-filter>
<action android:name="android.app.action.DEVICE_ADMIN_ENABLED" />
</intent-filter>
</receiver>
Success: Device owner set, you are ready. If you receive Failure: Not allowed to set device owner, you have two options:
--user 0 flag on Android 9+ with a test‑only build, but this is less reliable across manufacturers.Running adb shell dumpsys device_policy after setting the owner lets you verify that the package appears under “Device owner package”.
Even as device owner, Android will only allow lock‑task for apps that are explicitly whitelisted.
adb shell dpm set-lock-task-packages com.example.kiosk com.example.kiosk
Replace the second argument with a space‑separated list if you need multiple apps.
adb shell dpm get-lock-task-packages com.example.kiosk
You should see your package name echoed back.
Now that the system trusts the app, you can start it and it will automatically enter lock‑task.
adb shell am start -n com.example.kiosk/.KioskActivity
If the device still shows system UI, double‑check that the activity’s android:lockTaskMode attribute is set to if_whitelisted and that the package is correctly whitelisted.
Device‑owner APIs expose many policies you can enforce, such as disabling the status bar, blocking USB debugging, or enforcing a password. Below are a few useful calls you can run via adb shell (they affect the whole device):
adb shell settings put global policy_control immersive.full=*
1234 with your choice):
adb shell dpm set-password-complexity 0
adb shell dpm set-keyguard-enabled true
adb shell dpm set-keyguard-disabled false
adb shell locksettings set-pin 1234
adb shell dpm set-permission-grant-state com.example.kiosk android.permission.READ_EXTERNAL_STORAGE granted
Then disable the USB data mode via Settings > Connected devices > USB > No data transfer.
All of these commands can be scripted in a shell file on the device (using Termux) or on your PC for repeatable deployments.
In a pure kiosk you may never want users to leave the app, but administrators sometimes need an emergency exit.
Intent that the app listens for, e.g., com.example.kiosk.EXIT_KIOSK.adb shell am broadcast -a com.example.kiosk.EXIT_KIOSK
The app should call stopLockTask() and finish its activity, returning the user to the home screen.
If you cannot modify the app source, you can still break out of lock‑task by issuing a forced stop:
adb shell am force-stop com.example.kiosk
Use this only when you have physical access to the device.
Failure: Not allowed to set device owner.dpm set-device-owner command before completing the setup.dpm get-lock-task-packages.apktool) and verify the android:lockTaskMode attribute.
onCreate, call setSystemUiVisibility with the flags shown in Step 1.
adb shell settings put global policy_control immersive.full=*
PowerManager.WakeLock with a short timeout).adb shell settings put system screen_brightness 30.If you later decide the device should no longer be a kiosk, follow these steps:
adb shell dpm remove-active-admin com.example.kiosk/.MyDeviceAdminReceiver
adb shell dpm set-lock-task-packages com.example.kiosk
Notice the command ends with no package list, which clears the whitelist.
adb uninstall com.example.kiosk
adb reboot
After reboot, the device behaves like a regular Android phone.
adb over Wi‑Fi with a strong password on the network.
By leveraging Android’s built‑in device‑owner and lock‑task APIs you can turn any compatible phone or tablet into a robust kiosk without rooting, flashing, or installing third‑party launchers. The steps above give you a repeatable workflow: prepare a kiosk‑ready app, install it, set the device owner, whitelist the app, and fine‑tune restrictions. Troubleshooting tips help you recover from common hiccups, and the restoration procedure ensures you can revert the device if the kiosk purpose ends. With careful planning and the safety measures outlined, you’ll have a secure, single‑purpose Android terminal ready for signage, point‑of‑sale, education, or any scenario that demands a locked‑down UI.









