Per iniziare
Copia un prompt di configurazione con i passaggi di installazione e la guida markdown completa per questo plugin.
Set up this Capacitor plugin in the project.
Use the package manager already used by the project.
Install these package(s): `@capgo/capacitor-android-kiosk`
Run the required Capacitor sync/update step after installation.
Read this markdown guide for the full setup steps: https://raw.githubusercontent.com/Cap-go/website/refs/heads/main/apps/docs/src/content/docs/docs/plugins/android-kiosk/getting-started.mdx
Use that guide for platform-specific steps, native file edits, permissions, config changes, imports, and usage setup.
If that guide references other docs pages, read them too.
Puoi usare il nostro setup assistito dall'IA per installare il plugin. Aggiungi le skill Capgo al tuo strumento di IA usando il seguente comando:
npx skills add https://github.com/Cap-go/capgo-skills --skill capacitor-pluginsPoi usa il seguente prompt:
Use the `capacitor-plugins` skill from `Cap-go/capgo-skills` to install the `@capgo/capacitor-android-kiosk` plugin in my project.Se preferisci la configurazione manuale, installa il plugin eseguendo questi comandi e segui le istruzioni specifiche per piattaforma qui sotto:
npm install @capgo/capacitor-android-kiosknpx cap syncImporta
Sezione intitolata “Import”import { CapacitorAndroidKiosk } from '@capgo/capacitor-android-kiosk';Avvio rapido
Sezione intitolata “Quick start”import { CapacitorAndroidKiosk } from '@capgo/capacitor-android-kiosk';
await CapacitorAndroidKiosk.enterKioskMode();Errori comuni
Sezione intitolata “Errori comuni”- Launcher: imposta l'app come launcher predefinito per un blocco kiosk affidabile.
- MDM: valida le escape hatch prima di rilasciare le build della flotta.
- iOS: non supportato.
Panoramica API
Sezione intitolata “Panoramica API”isInKioskMode
Sezione intitolata “isInKioskMode”Verifica se l'app è attualmente in esecuzione in modalità kiosk.
import { CapacitorAndroidKiosk } from '@capgo/capacitor-android-kiosk';
const { isInKioskMode } = await CapacitorAndroidKiosk.isInKioskMode();console.log('Kiosk mode active:', isInKioskMode);isSetAsLauncher
Sezione intitolata “isSetAsLauncher”Verifica se l'app è impostata come launcher del dispositivo (home app).
import { CapacitorAndroidKiosk } from '@capgo/capacitor-android-kiosk';
const { isLauncher } = await CapacitorAndroidKiosk.isSetAsLauncher();console.log('Is launcher:', isLauncher);enterKioskMode
Sezione intitolata “enterKioskMode”Attiva la modalità kiosk, nascondendo l'interfaccia di sistema e bloccando i pulsanti hardware. Avvia anche un servizio foreground keep-alive per ridurre la probabilità che il sistema chiuda l'app. Per funzionare correttamente, l'app deve essere impostata come launcher del dispositivo.
import { CapacitorAndroidKiosk } from '@capgo/capacitor-android-kiosk';
await CapacitorAndroidKiosk.enterKioskMode();exitKioskMode
Sezione intitolata “exitKioskMode”Disattiva la modalità kiosk, ripristinando l'interfaccia di sistema normale e la funzionalità dei pulsanti hardware. Ferma anche il servizio foreground keep-alive avviato in enterKioskMode().
import { CapacitorAndroidKiosk } from '@capgo/capacitor-android-kiosk';
await CapacitorAndroidKiosk.exitKioskMode();console.log('Exited kiosk mode');setAsLauncher
Sezione intitolata “setAsLauncher”Apre le impostazioni della schermata home del dispositivo per consentire all'utente di impostare questa app come launcher. È necessario per la piena funzionalità della modalità kiosk.
import { CapacitorAndroidKiosk } from '@capgo/capacitor-android-kiosk';
await CapacitorAndroidKiosk.setAsLauncher();// User will be prompted to select this app as the home appsetAllowedKeys
Sezione intitolata “setAllowedKeys”Imposta quali tasti hardware sono consentiti in modalità kiosk. Di default, tutti i tasti hardware sono bloccati in modalità kiosk.
import { CapacitorAndroidKiosk } from '@capgo/capacitor-android-kiosk';
// Allow volume keys onlyawait CapacitorAndroidKiosk.setAllowedKeys({ volumeUp: true, volumeDown: true, back: false, home: false, recent: false});Riferimento ai tipi
Sezione: “Type Reference”EnterKioskModeOptions
Sezione intitolata “EnterKioskModeOptions”Flag opzionali per enterKioskMode.
export interface EnterKioskModeOptions { /** * 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()`. */ restoreAfterReboot?: 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. */ relaunch?: boolean;
/** Minutes between relaunch attempts when `relaunch` is on. Range 5–60; default 15. */ relaunchIntervalMinutes?: number;}AllowedKeysOptions
Sezione intitolata “AllowedKeysOptions”Opzioni di configurazione per le chiavi hardware consentite in modalità kiosk.
export interface AllowedKeysOptions { /** * Allow volume up button * @default false */ volumeUp?: boolean;
/** * Allow volume down button * @default false */ volumeDown?: boolean;
/** * Allow back button * @default false */ back?: boolean;
/** * Allow home button * @default false */ home?: boolean;
/** * Allow recent apps button * @default false */ recent?: boolean;
/** * Allow power button * @default false */ power?: boolean;
/** * Allow camera button (if present) * @default false */ camera?: boolean;
/** * Allow menu button (if present) * @default false */ menu?: boolean;}Fonte di verità
Sezione intitolata “Fonte di verità”Questa pagina è generata dal src/definitions.ts. Riesegui la sync quando il API pubblico cambia upstream.
Continua da Getting Started
Sezione intitolata “Continua da Getting Started”Se stai usando Per iniziare per pianificare le operazioni della dashboard e di API, collegalo a Utilizzo di @capgo/capacitor-android-kiosk per la funzionalità nativa in Utilizzo di @capgo/capacitor-android-kiosk, Panoramica API per i dettagli di implementazione in Panoramica di API, Introduzione per i dettagli di implementazione in Introduzione, Chiavi API per i dettagli di implementazione in Chiavi API, e Dispositivi per i dettagli di implementazione in Dispositivi.