Android Kiosk Mode: Enabling Restrictions

Anna Voronova

Anna Voronova

IT copywriter


9 Jun 2016

Reading time:

9 Jun 2016

Kiosks are everywhere. Of course, we’re not talking about ice cream or lemonade stands here, our post is about interactive information kiosks.

A typical information kiosk is a computer terminal, which the user can use to perform a limited set of actions. Common examples are ATMs, photo booths, automated ticket and check-in kiosks, and others.

Interactive kiosks use various technologies: touch screen, bill acceptor, photo and video cameras, printers and scanners, Wi-Fi, NFC, etc. But their common feature is a strong protection system against unauthorized activity. The software used in such terminals doesn’t allow the user to change the system’s settings, reset, or install additional applications.

Mobile kiosks

Rapid development of mobile technologies has revolutionized kiosks. Smartphones and tablets are now commonly used as information kiosks. Mobile kiosks have a number of significant advantages over standard terminals: they are cheaper due to the compact size and mass production, but also have a broader functionality. Mobile kiosks are used as electronic menus in restaurants, manuals for sales assistants in stores and showrooms, etc. Whatever the purpose is, it’s important that when a mobile device serves the purpose of a kiosk, it should not be used for any other purposes.

Mobile kiosks have a number of significant advantages over standard terminals. 

To make the device work in kiosk mode, it needs to run a program that blocks the typical functions of the operating system and does not allow the user to exit application. Kiosk apps may have a secret administrative panel or be remotely configured from the server. You can also configure system reports: the app will send statistics about user behavior to the server and inform the administrator about its status.

Read on to learn more about Android kiosk mode. Below you’ll find a how-to guide and the most common pitfalls.

Android Kiosk Mode

To turn an Android device into a kiosk, it’s a good idea to lock all of its buttons and connectors. In this case, the most banal and at the same time the most effective solution would be to place your device in a vandal-proof box or a specialized stand. This, however, isn’t always possible. Besides, the status bar, system dialogs, and virtual keypad can still be accessed by any user and settings can be changed. How do you avoid all these problems?

Android 5.0: the long-awaited API

Let’s start with the good news: in Android 5.0 a new Screen pinning API was introduced. This API “pins” the screen and prevents users to leave the selected application. This functionality can be used to create kiosks for staff and to develop educational apps for assessment and examination.

When you activate the Screen pinning mode, user is not interrupted by system dialogs and notifications, has no access to other applications, cannot go to the main screen, and does not see the status bar anymore.

You can activate this mode via settings or software:

  • Switch on Screen pinning mode in Settings, select the desired application and attach it to confirm your choice.
  • For a software activation call the startLockTask() and confirm the inclusion of the lock mode.

Android before 5.0: how to get around the system?

In earlier versions of Android SDK, kiosk mode, unfortunately, is not provided. There is also no holistic and comprehensive API to block the system. Therefore, all components are locked separately and differently in different versions.

By OS customization you can simplify the Android kiosk mode setup, but we’d like to introduce some techniques that block unwanted items in Android versions below 5.0 without special firmware or root access.


The first thing that may come to a user’s mind when the device freezes is to reboot it. Our task is to make sure that after the tablet or smartphone is restarted, the kiosk app starts automatically.

This isn’t hard: describe Receiver in Manifest, give permission to receive messages after rebooting, and then extend class Broadcastreceiver that will run our app.


<receiver android:name=".BootReceiver"> 
 <intent-filter > 
 <action android:name= 
 android:name="android.permission.RECEIVE_BOOT_COMPLETED" />

BootReceiver.java :

public class BootReceiver extends BroadcastReceiver { 
 public void onReceive(Context context, Intent intent) { 
 Intent myIntent = new Intent(context, MyKioskModeActivity.class); 

BACK button

For the Back button just override method.

public void onBackPressed() { 
 // here we do nothing 

HOME button

HOME button cannot be intercepted, therefore, to prevent transfer to the main screen when it is pressed, we specify an application kiosk as the Launcher. Add the three lines in Manifest:


 <action android:name="android.intent.action.MAIN" /> 
 <category android:name="android.intent.category.HOME" /> 
 <category android:name="android.intent.category.LAUNCHER" /> 
 <category android:name="android.intent.category.DEFAULT" /> 

As a result, when you press the HOME button, the system offers you a choice between two launchers: stock and our kiosk application. Choose our application as the default launcher – and you’re done!

POWER button

POWER button causes the most problems. One way to handle them is to set the kiosk application window as a lock screen. However, this method is guaranteed to work only on Android versions below 4.0.

public void onAttachedToWindow() { 

System dialogues

Long press of HOME or POWER button calls a system dialogues that allows you to exit the application. In addition there are OS updates and low battery windows, which are also dangerous to the kiosk because they can have access to system settings.

To completely get rid of the system of dialogues we recommend the following: when Activity focus is lost, it sends Broadcast: Close all system dialogs.

public void onWindowFocusChanged(boolean hasFocus) { 
 if(!hasFocus) { 
 Intent closeDialog = 

Virtual Keyboard

There could be a ‘settings’ button on the virtual keyboard. If the keyboard is required, the best solution is to create a custom version or integrate the existing one with limited functionality.

Status bar

Status bar provides a wide range of opportunities to exit the application, so you must get rid of it. The first thing you should do is to make the application full screen.

In Android 4.0 and below, you can also specify the type of window as TYPE_SYSTEM_ALERT — in this case, the application kiosk will be displayed on top of all system elements.

Another way is to hide the status bar, as soon as it is ready to appear. To do this, you must specify the resolution of the Manifest.

public void onWindowFocusChanged(boolean hasFocus)<br> 
 Object service = getSystemService("statusbar"); 
 Class<?> statusbarManager = 
 Method collapse = <br> 
 collapse .setAccessible(true); 
 collapse .invoke(service); 

Starting with Android 4.1 you can use the SDK for hiding the status bar.

View decorView = getWindow().getDecorView(); 
int uiOptions = View.SYSTEM_UI_FLAG_FULLSCREEN; 
ActionBar actionBar = getActionBar(); 

Another popular method is to create a transparent View object, which intercepts all clicks on the site of the status bar. To implement it the flag SYSTEM_ALERT_WINDOW is required.

The described techniques are only a few possible options for locking system elements in Android. Developers are constantly finding or inventing new approaches and sharing their experiences with other developers in order to create kiosk applications with restrictions that cannot be overcome by users.

Share with us your own tips on kiosk app development for Android. Do you use the methods we described or do you know any other useful hacks?


Filter by