npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@capgo/capacitor-android-kiosk

v8.3.5

Published

Android Kiosk Mode plugin for Capacitor - Lock device into kiosk mode with launcher functionality

Readme

capacitor-android-kiosk

Lock an Android device into kiosk mode from your Capacitor app: hide system UI, block hardware buttons and run as the home launcher. Built for point of sale, signage and single-purpose devices.

🤖 Building with an AI coding agent? Install Capgo skills so Claude Code, Codex, Cursor, Copilot, or Gemini CLI know how to install and use @capgo/capacitor-android-kiosk in your Capacitor app: npx skills add Cap-go/capgo-skills. Then ask your agent: "Add @capgo/capacitor-android-kiosk to my Capacitor app and wire it up." Agent setup guides · Hosted MCP

Built and maintained with AI

We build, improve and fix our plugins with heavy use of AI, so issues usually get fixed in under a day and pull requests get feedback the same day. A human still reviews, tests and merges 50+ pull requests daily.

  • Most plugin issues get a fix pull request the same day, often within a couple of hours, and are usually resolved in one to two days.
  • Every pull request goes through our AI review system, usually within minutes.
  • Our AI pre-checks tests, code review, conventions and security, then a human reviews, tests and merges.
  • A human, Martin, reviews, tests and merges 50+ pull requests every day.
  • In the last 90 days, 95% of plugin issues were resolved.

Learn more about how we build with AI

Key features

  • Kiosk mode: enterKioskMode() hides system UI and blocks hardware buttons, exitKioskMode() restores them.
  • Launcher: setAsLauncher() opens home screen settings so your app can become the launcher, isSetAsLauncher() checks it.
  • Allowed keys: setAllowedKeys() picks which hardware keys keep working in kiosk mode.
  • State check: isInKioskMode() reports whether kiosk mode is active.
  • Platforms: Android. Android only. iOS and web are not supported.

Documentation

The most complete doc is available here: https://capgo.app/docs/plugins/android-kiosk/

Compatibility

| Plugin version | Capacitor compatibility | Maintained | | -------------- | ----------------------- | ---------- | | v8.*.* | v8.*.* | ✅ | | v7.*.* | v7.*.* | On demand | | v6.*.* | v6.*.* | ❌ | | v5.*.* | v5.*.* | ❌ |

Note: The major version of this plugin follows the major version of Capacitor. Use the version that matches your Capacitor installation (e.g., plugin v8 for Capacitor 8). Only the latest major version is actively maintained.

Install

You can use our AI-Assisted Setup to install the plugin. Add the Capgo skills to your AI tool using the following command:

npx skills add https://github.com/cap-go/capacitor-skills --skill capacitor-plugins

Then use the following prompt:

Use the `capacitor-plugins` skill from `cap-go/capacitor-skills` to install the `@capgo/capacitor-android-kiosk` plugin in my project.

If you prefer Manual Setup, install the plugin by running the following commands and follow the platform-specific instructions below:

npm install @capgo/capacitor-android-kiosk
npx cap sync

Platform Support

This plugin is Android-only. For iOS kiosk mode functionality, please use the device's built-in Guided Access feature.

Features

  • Kiosk Mode: Hide system UI and enter immersive fullscreen mode
  • Keep-alive: Foreground service while in kiosk; stopped when you call exitKioskMode().
  • Session options: restoreAfterReboot tries to opens the app again after reboot; relaunch + relaunchIntervalMinutes tries to bring the UI forward on a timer.
  • Launcher Integration: Set your app as the device launcher/home app
  • Hardware Key Control: Block or allow specific hardware buttons
  • Status Detection: Check if kiosk mode is active or if app is set as launcher
  • Android 6.0+: Supports Android API 23 through Android 15 (API 35)

Usage

Basic Kiosk Mode

import { CapacitorAndroidKiosk } from '@capgo/capacitor-android-kiosk';

// Enter kiosk mode (with optional: restoreAfterReboot, relaunch, relaunchIntervalMinutes)
await CapacitorAndroidKiosk.enterKioskMode();

// Exit kiosk mode
await CapacitorAndroidKiosk.exitKioskMode();

// Check if in kiosk mode
const { isInKioskMode } = await CapacitorAndroidKiosk.isInKioskMode();
console.log('Kiosk mode active:', isInKioskMode);

Launcher Functionality

For full kiosk mode functionality, you need to set your app as the device launcher:

// Open home screen settings for user to select your app as launcher
await CapacitorAndroidKiosk.setAsLauncher();

// Check if app is set as launcher
const { isLauncher } = await CapacitorAndroidKiosk.isSetAsLauncher();
console.log('App is launcher:', isLauncher);

Hardware Key Control

// Allow only volume keys
await CapacitorAndroidKiosk.setAllowedKeys({
  volumeUp: true,
  volumeDown: true,
  back: false,
  home: false,
  recent: false
});

// Block all keys (default)
await CapacitorAndroidKiosk.setAllowedKeys({});

Complete Example

async function setupKioskMode() {
  try {
    // Check if already set as launcher
    const { isLauncher } = await CapacitorAndroidKiosk.isSetAsLauncher();

    if (!isLauncher) {
      // Prompt user to set as launcher
      await CapacitorAndroidKiosk.setAsLauncher();
      alert('Please select this app as your Home app');
      return;
    }

    // Configure allowed keys
    await CapacitorAndroidKiosk.setAllowedKeys({
      volumeUp: true,
      volumeDown: true,
      back: false,
      home: false,
      recent: false,
      power: false
    });

    // Enter kiosk mode
    await CapacitorAndroidKiosk.enterKioskMode();
    console.log('Kiosk mode activated');

  } catch (error) {
    console.error('Failed to setup kiosk mode:', error);
  }
}

API

Capacitor Android Kiosk Plugin for controlling kiosk mode and launcher functionality. This plugin is Android-only. For iOS kiosk mode, use the device's Guided Access feature.

isInKioskMode()

isInKioskMode() => Promise<{ isInKioskMode: boolean; }>

Checks if the app is currently running in kiosk mode.

Returns: Promise<{ isInKioskMode: boolean; }>

Since: 1.0.0


isSetAsLauncher()

isSetAsLauncher() => Promise<{ isLauncher: boolean; }>

Checks if the app is set as the device launcher (home app).

Returns: Promise<{ isLauncher: boolean; }>

Since: 1.0.0


enterKioskMode(...)

enterKioskMode(options?: EnterKioskModeOptions | undefined) => Promise<void>

Enters kiosk mode, hiding system UI and blocking hardware buttons. Also starts a foreground keep-alive service so the app is less likely to be killed by the system. The app must be set as the device launcher for this to work effectively.

| Param | Type | Description | | ------------- | ----------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------- | | options | EnterKioskModeOptions | Optional. Omit restoreAfterReboot or relaunch to keep their saved values; pass them when you want to change. |

Since: 1.0.0


exitKioskMode()

exitKioskMode() => Promise<void>

Exits kiosk mode, restoring normal system UI and hardware button functionality. Also stops the foreground keep-alive service started in enterKioskMode().

Since: 1.0.0


setAsLauncher()

setAsLauncher() => Promise<void>

Opens the device's home screen settings to allow user to set this app as the launcher. This is required for full kiosk mode functionality.

Since: 1.0.0


setAllowedKeys(...)

setAllowedKeys(options: AllowedKeysOptions) => Promise<void>

Sets which hardware keys are allowed to function in kiosk mode. By default, all hardware keys are blocked in kiosk mode.

| Param | Type | Description | | ------------- | ----------------------------------------------------------------- | ------------------------------ | | options | AllowedKeysOptions | Configuration for allowed keys |

Since: 1.0.0


getPluginVersion()

getPluginVersion() => Promise<{ version: string; }>

Get the native Capacitor plugin version.

Returns: Promise<{ version: string; }>

Since: 1.0.0


Interfaces

EnterKioskModeOptions

Optional flags for enterKioskMode.

| Prop | Type | Description | | ----------------------------- | -------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | restoreAfterReboot | boolean | After reboot, start the app so you can call enterKioskMode() again. Best-effort only (OEM behavior, force-stop). Omit to keep the saved value. Cleared when you call exitKioskMode(). | | relaunch | boolean | Periodically tries to bring the app to the foreground. Skipped while the screen is off. Often blocked from the background on some devices—being the default launcher, relaxing battery limits, and allowing exact alarms (where required) improve odds. Omit to keep the saved value. | | relaunchIntervalMinutes | number | Minutes between relaunch attempts when relaunch is on. Range 5–60; default 15. |

AllowedKeysOptions

Configuration options for allowed hardware keys in kiosk mode.

| Prop | Type | Description | Default | | ---------------- | -------------------- | -------------------------------- | ------------------ | | volumeUp | boolean | Allow volume up button | false | | volumeDown | boolean | Allow volume down button | false | | back | boolean | Allow back button | false | | home | boolean | Allow home button | false | | recent | boolean | Allow recent apps button | false | | power | boolean | Allow power button | false | | camera | boolean | Allow camera button (if present) | false | | menu | boolean | Allow menu button (if present) | false |

Android Configuration

1. MainActivity Setup

To enable full hardware key blocking, you need to override dispatchKeyEvent in your MainActivity.java:

import android.view.KeyEvent;
import ee.forgr.plugin.android_kiosk.CapacitorAndroidKioskPlugin;

public class MainActivity extends BridgeActivity {
    @Override
    public boolean dispatchKeyEvent(KeyEvent event) {
        // Get the kiosk plugin
        CapacitorAndroidKioskPlugin kioskPlugin = (CapacitorAndroidKioskPlugin)
            this.getBridge().getPlugin("CapacitorAndroidKiosk").getInstance();

        if (kioskPlugin != null && kioskPlugin.shouldBlockKey(event.getKeyCode())) {
            return true; // Block the key
        }

        return super.dispatchKeyEvent(event);
    }

    @Override
    public void onBackPressed() {
        // Don't call super.onBackPressed() to disable back button
        // Or call the plugin's handleOnBackPressed
    }
}

2. AndroidManifest.xml

Add launcher intent filter to make your app selectable as a launcher:

<activity
    android:name=".MainActivity"
    ...>

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

    <!-- Add this to make app selectable as launcher -->
    <intent-filter>
        <action android:name="android.intent.action.MAIN" />
        <category android:name="android.intent.category.HOME" />
        <category android:name="android.intent.category.DEFAULT" />
    </intent-filter>
</activity>

Important Notes

  1. Launcher Requirement: For full kiosk mode functionality (blocking home button, preventing task switching), your app must be set as the device launcher.

  2. Testing: When testing, you can exit kiosk mode programmatically or by setting another app as the launcher.

  3. Android Versions: The plugin uses modern Android APIs for Android 11+ and falls back to older methods for compatibility with Android 6.0+.

  4. Security: This plugin is designed for legitimate kiosk applications. Ensure you provide users with a way to exit kiosk mode.

  5. Battery: Kiosk mode keeps the screen on. Consider implementing your own screen timeout or brightness management.

iOS Alternative

For iOS devices, use the built-in Guided Access feature:

  1. Go to Settings > Accessibility > Guided Access
  2. Turn on Guided Access
  3. Set a passcode
  4. Open your app
  5. Triple-click the side button
  6. Adjust settings and start Guided Access

Contributing

See CONTRIBUTING.md

License

MIT

Author

Martin Donadieu [email protected]