Skip to content

Simplest way to create a application in kiosk mode/ single purpose device application in android. i e. only the single application can be accessed from the device without any root or special permission.

Notifications You must be signed in to change notification settings

dinkar1708/KioskModeAndroid

 
 

Repository files navigation

KioskModeAndroid

Fixed English:

Overview This guide provides the simplest way to create an application in kiosk mode for a single-purpose device. In this mode, only the designated application can be accessed without requiring any root or special permissions.

We will achieve this by utilizing screen pinning, a feature available on all versions of Android devices without the need for root access or special permissions.

Configuration To create the kiosk mode, follow these steps:

  1. Include the necessary files from the provided source code.

  2. Disable the following components of the Android device for the kiosk mode: a. Back button of the device b. Home button of the device c. Recent task button of the device d. Status bar of the device

By implementing the above steps, your application will run in kiosk mode, ensuring that only the designated application can be accessed on the device without the user having access to other functionalities or applications.

Basic crucks to achieve above -

*. Entry in manifiest -

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

*. Basics permissions

 <uses-permission android:name="android.permission.REORDER_TASKS" />
 <uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" />

*. Ovirride back button

@Override
    public void onBackPressed() {
        if (!kioskMode.isLocked(this)) {
            super.onBackPressed();
        }
    }

*. override user leave hint method

@Override
    protected void onUserLeaveHint() {
        super.onUserLeaveHint();
        //move current activity to front if required
        Log.i(TAG, "onUserLeaveHint()...");
        kioskMode.moveTaskToFront(this);
    }
    
    /**
     * call this from onUserLeaveHint() from every activity
     * Ask that the task associated with a given task ID be moved to the
     * front of the stack, so it is now visible to the user.
     *
     * @param activity to move in front
     */
    public void moveTaskToFront(Activity activity) {
        boolean isLocked = isLocked(activity);
        if (!isLocked) {
            return;
        }
        ((ActivityManager) activity.getApplicationContext().getSystemService(Context.ACTIVITY_SERVICE))
                .moveTaskToFront(activity.getTaskId(), 1);
    }

*. My kiosk mode singlton class to manage lock unlock -

public class KioskMode {
    private static final String TAG = KioskMode.class.getSimpleName();

    private static KioskMode kioskMode;
    private WindowManager windowManager;
    private CustomViewGroup interceptView;

    /**
     * prevent creating object multiple time
     */
    private KioskMode() {
    }

For detail configuration please visit-

http://dinkarcse.blogspot.in/2017/06/android-kiosk-modesingle-purpose-app.html

About

Simplest way to create a application in kiosk mode/ single purpose device application in android. i e. only the single application can be accessed from the device without any root or special permission.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Java 100.0%