Set Up Screen Pinning and Lock Task Mode on Android for Kiosk‑Style Use

13 min read Step‑by‑step guide to enable Android’s screen pinning and lock‑task mode, turning any device into a simple kiosk without rooting or third‑party software. September 27, 2026 16:30 How to Set Up Screen Pinning and Lock Task Mode on Android for a Kiosk‑Style App

Why you might need screen pinning or lock‑task mode

Many businesses, schools, and public venues want a single Android device to run one app and prevent users from leaving it. Android offers two built‑in mechanisms:

  • Screen pinning – a quick, user‑initiated way to lock the current app. It works on any device running Android 5.0 (Lollipop) or later, requires no special permissions, and can be disabled with a PIN or pattern.
  • Lock task mode – a developer‑controlled “kiosk” mode that removes the status bar, navigation buttons, and system dialogs. It is meant for dedicated devices and requires a device‑owner app (or a profile‑owner on Android 9+).

This tutorial shows both methods, explains when each is appropriate, and walks you through a safe, reproducible setup using only ADB – no rooting, no flashing, and no third‑party launchers.

Before you start

Make sure you have a computer with adb installed (part of Android SDK Platform‑Tools). If you haven’t installed it yet, download the zip from Google’s developer site, extract it, and add the folder to your system PATH.

  • Charge the Android device to at least 50 % to avoid accidental shutdown during ADB commands.
  • Enable Developer options: Settings > About phone > tap Build number seven times.
  • Enable USB debugging: Settings > System > Advanced > Developer options > USB debugging.
  • Connect the phone to the computer via USB and verify the connection with adb devices. You should see the device listed as device (not unauthorized).
  • If the device is brand‑specific (Samsung, Xiaomi, etc.), the wording of menu items may differ slightly – the steps below note the most common variants.

Part 1 – Enabling and using Screen Pinning

1. Turn on the Screen Pinning feature

  1. Open Settings.
  2. Navigate to Security (or Security & location on some devices).
  3. Tap Screen pinning. If you don’t see it, look under Advanced or Device administration.Toggle the switch to On.
  4. Optionally enable the checkbox “Ask for PIN before unpinning” – this adds an extra layer of protection.

2. Pin an app

  1. Open the app you want to lock (e.g., a digital signage app, a web kiosk, or even Settings).
  2. Enter the recent‑apps view (usually the square navigation button or a swipe‑up‑and‑hold gesture).
  3. Tap the app’s thumbnail to bring up the pin icon (a small push‑pin). On some OEM skins the pin appears as a lock icon.
  4. Tap the pin icon. If you enabled “Ask for PIN before unpinning”, you’ll be prompted to enter your device PIN/pattern.

3. What you should see

The device now shows only the pinned app. The back, home, and recent‑apps buttons are disabled. Swiping from the edges or pressing the power button will only turn the screen off – the app stays in the foreground.

4. Unpinning

To exit, hold the Back and Overview (recent‑apps) buttons simultaneously, or enter the PIN you set earlier. If you never set a PIN, the device will ask for the lock screen credential.

When screen pinning isn’t enough

Screen pinning relies on the user to initiate the lock. For truly dedicated devices (e.g., an information kiosk in a lobby), you need a mode that cannot be escaped without an administrator command. That’s where lock task mode comes in.

Part 2 – Setting up Lock Task Mode (Kiosk Mode)

Overview of the steps

  1. Create a minimal “device‑owner” app (or use an existing one) that declares android:lockTaskMode support.
  2. Install the app via ADB.
  3. Make the app the device owner using ADB.
  4. Whitelist the app for lock‑task mode.
  5. Start the app and trigger lock‑task mode.

If you already have a kiosk‑ready app (many commercial solutions provide a .apk that can be set as device owner), you can skip step 1 and jump straight to installing it.

1. Prepare a simple device‑owner app (optional)

If you are comfortable with Android Studio, create a new project and add the following to the AndroidManifest.xml:

<application ...>
    <activity android:name=".MainActivity"
        android:label="Kiosk"
        android:exported="true"
        android:lockTaskMode="if_whitelisted">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>
    <receiver android:name=".MyDeviceAdminReceiver"
        android:permission="android.permission.BIND_DEVICE_ADMIN"
        android:exported="true">
        <meta-data android:name="android.app.device_admin"
            android:resource="@xml/device_admin_receiver" />
    </receiver>
</application>

Also create res/xml/device_admin_receiver.xml with the standard device‑admin declaration. Build the APK and keep the package name handy (e.g., com.example.kiosk).

2. Install the APK via ADB

  1. Copy the .apk to the same folder as your adb binary.
  2. Run adb install -r com.example.kiosk.apk. The -r flag allows reinstalling without wiping data.
  3. Confirm the installation succeeded (you’ll see Success in the terminal).

3. Designate the app as device owner

Only a freshly‑provisioned device (factory‑reset) can accept a new device owner. If the device already has a user profile, you must factory‑reset it first (Settings > System > Reset > Erase all data). After the reset, skip the initial setup screens until you reach the “Add Google Account” step, then press Back to skip it – this leaves the device in a “setup mode” that accepts a device‑owner command.

  1. Connect the device via USB.
  2. Run adb shell dpm set-device-owner com.example.kiosk/.MyDeviceAdminReceiver.
  3. If the command returns Success: Device owner set, the app is now the device owner.

Why this matters: The device‑owner status grants the app privileged APIs, including the ability to lock the screen into a single app.

4. Whitelist the app for lock‑task mode

Even as a device owner, Android requires you to explicitly permit which packages may enter lock task mode.

  1. Run adb shell dpm set-lock-task-packages com.example.kiosk com.example.kiosk.
  2. Verify with adb shell dpm get-lock-task-packages com.example.kiosk. The output should list your package name.

5. Launch the app in lock‑task mode

Now start the app and tell it to lock itself. The simplest way is to add the following line to the activity’s onCreate() method:

if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
    startLockTask();
}

If you cannot modify the source code (e.g., you are using a third‑party kiosk app), you can trigger lock task from ADB:

  1. Start the app: adb shell monkey -p com.example.kiosk -c android.intent.category.LAUNCHER 1
  2. Enter lock task: adb shell am start -n com.example.kiosk/.MainActivity --ez "android.intent.extra.LOCK_TASK" true (some apps expose a custom intent; check the developer docs).

When the call succeeds, the navigation bar disappears, the status bar is hidden, and the device cannot exit the app without an admin command.

Testing the kiosk

  • Press the power button – the screen should turn off, but on wake‑up the same app appears.
  • Try the back, home, or recent‑apps gestures – they are ignored.
  • Connect a USB mouse or Bluetooth keyboard – the system UI is still hidden.

If any of these actions break out of the app, double‑check that the package is correctly whitelisted and that startLockTask() was called after the activity is fully resumed.

Troubleshooting

Screen pinning not appearing in Settings

  • Some OEM skins hide the option under Biometrics & security or Lock screen preferences. Use the search bar in Settings and type “pin” to locate it.
  • On Android 12+, the feature is called Pin windows in System > Multitasking.
  • If the toggle is greyed out, the device administrator may have disabled it. Remove any third‑party device‑admin apps via Settings > Security > Device admin apps.

Lock task mode fails with “SecurityException”

  • Make sure the device is **freshly reset** before assigning a device owner. Once a user is created, Android blocks the dpm set-device-owner command.
  • Confirm the receiver class name matches exactly (including the leading dot) in the dpm command.
  • Check the log with adb logcat | grep dpm for more details.

Unable to exit lock task mode

  • From a computer, run adb shell am stopservice -n com.example.kiosk/.MyDeviceAdminReceiver or simply reboot the device.
  • If you need a user‑friendly way to exit, implement a hidden “admin” gesture in the app that calls stopLockTask() after verifying a PIN.

Device‑owner command not recognized on Android 10+

  • From Android 10 onward, the command syntax is unchanged, but the device must be in provisioning mode. After a factory reset, skip the Google account step and run the dpm command immediately.
  • Some manufacturers (e.g., Samsung Knox) require the device to be enrolled in their own management platform before accepting a generic device owner.

Safety warnings

Setting a device owner gives the app full control over the device. Only use this on devices you intend to lock down permanently. Removing the device owner requires a factory reset, which erases all user data.

Screen pinning is safe for occasional use but should not replace a proper device‑owner kiosk when the device is publicly accessible.

What to do after the kiosk is running

  • Configure Auto‑start (some devices have a “Launch on boot” option in the app’s settings) so the kiosk app starts after a power loss.
  • Disable USB debugging if the device will stay in the field – this prevents unintended ADB access.
  • Consider enrolling the device in a Mobile Device Management (MDM) solution for remote wipe or policy updates.

With screen pinning you get a quick, user‑initiated lock that works on any Android phone. With lock‑task mode you obtain a true kiosk experience that can’t be escaped without administrative intervention. Choose the method that matches your security requirements, follow the steps above, and you’ll have a reliable, Android‑based kiosk without rooting or third‑party launchers.

User Comments (0)

Add Comment
We'll never share your email with anyone else.