1.0.3 • Published 6 years ago

@isearch-lab/cordova-plugin-screen-pinning v1.0.3

Weekly downloads
-
License
MIT
Repository
github
Last release
6 years ago

Cordova screen pinning plugin

Cordova plugin exposing Android (API 21+) screen pinning APIs.

Installation

Run the following command inside your project's folder:

cordova plugin add cordova-plugin-screen-pinning

Usage

enterPinnedMode()

cordova.plugins.screenPinning.enterPinnedMode(successCallback, errorCallback);

exitPinnedMode()

cordova.plugins.screenPinning.exitPinnedMode(successCallback, errorCallback);

Device owner (Kiosk Mode)

With the normal pinned mode, user can leave pinned mode easily with a combination of buttons. If, instead, you need your app to run in a sort of "Kiosk mode" (which the user cannot leave), you first need to set your app as the device owner:

In order to set your app as the device owner you need to run this command while your device is plugged via USB debug:

adb shell dpm set-device-owner <YOUR APP PACKAGE NAME>/me.raimaj.plugin.DefaultDeviceAdminReceiver

For example, if your app package is "com.mydomain.myapp", you would run:

adb shell dpm set-device-owner com.mydomain.myapp/me.raimaj.plugin.DefaultDeviceAdminReceiver

After you have set your app as the device owner, you can do the following:

cordova.plugins.screenPinning.enterPinnedMode(successCallback, errorCallback, true);