Giter Club home page Giter Club logo

kioskmodeandroid's Introduction

KioskModeAndroid

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

Screen pinning on all version of android devices without root/any special permission.

Configuration-

Include files from this source code.

The following components of android device are disabled for this kiosk mode Back button of device, Home button of device, recent task button of device and Status bar of device

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

kioskmodeandroid's People

Contributors

dinkar1708 avatar

Watchers

 avatar

Forkers

actorexpose

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.