🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
DemoInstallSign in
Socket

kiosk-react-native

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

kiosk-react-native

A Library for setting up kiosk mode with react native

0.1.2
latest
Source
npm
Version published
Weekly downloads
433
-1.59%
Maintainers
1
Weekly downloads
 
Created
Source

kiosk-mode-react-native

A Library for setting up kiosk mode on Android with react native

Installation

npm install kiosk-react-native

Usage

import { enableKioskMode, disableKioskMode } from 'kiosk-react-native';

// Enable Kiosk Mode
enableKioskMode();

// Disable Kiosk Mode
disableKioskMode();

For Higher Order Access

We need device owner permission for the app for higher order access like disable volume buttons,prevent uninstallation etc.

Add below configuration to AndroidManifest.xml(android/app/src/main/AndroidManifest.xml)

Add android:testOnly . This will allow to developers to uninstall and remove admin for the app.

    <application
      android:name=".MainApplication"
      android:label="@string/app_name"
      android:supportsRtl="true"
      android:testOnly="true" 
      ...Rest of the App

Now create a new "device_owner.xml" file (android/app/src/main/xml/device_owner.xml) and add the following code.

    <?xml version="1.0" encoding="utf-8"?>
    <device-admin>
        <uses-policies>
            <limit-password/>
            <watch-login/>
            <reset-password/>
            <force-lock/>
            <wipe-data/>
            <expire-password/>
            <encrypted-storage/>
            <disable-camera/>
        </uses-policies>
    </device-admin>

Add a new reciever to your AndroidManifest.xml(android/app/src/main/AndroidManifest.xml).

    <receiver
        android:name="com.kiosk.RNKioskDevice"
        android:label="@string/app_name"
        android:exported="true"
        android:permission="android.permission.BIND_DEVICE_ADMIN">
        <meta-data
            android:name="android.app.device_admin"
            android:resource="@xml/device_owner" />
        <intent-filter>
            <action android:name="android.app.action.DEVICE_ADMIN_ENABLED"/>
        </intent-filter>
    </receiver>

Finally run the following script using adb

adb shell dpm set-device-owner <YourPackageName>/com.kiosk.RNKioskDevice

Rebuild the app. The app should run in admin mode now.

To Remove the device from owner

adb shell dpm remove-active-admin <YourPackageName>/com.kiosk.RNKioskDevice

License

MIT

Made with create-react-native-library

Keywords

react-native

FAQs

Package last updated on 04 Jun 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts