Inizia
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.
Installazione
Sottosezione intitolata “Installazione”Puoi utilizzare la nostra configurazione assistita dall'IA per installare il plugin. Aggiungi le Capgo competenze al tuo strumento di AI utilizzando il seguente comando:
npx skills add https://github.com/Cap-go/capgo-skills --skill capacitor-pluginsPoi utilizza la seguente richiesta:
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 i seguenti comandi e segui le istruzioni specifiche del tuo sistema operativo di seguito:
bun add @capgo/capacitor-android-kioskbunx cap syncImporta
Sezione intitolata “Importa”import { CapacitorAndroidKiosk } from '@capgo/capacitor-android-kiosk';API Panoramica
Sezione intitolata “API Panoramica”isInKioskMode
Sezione intitolata “isInKioskMode”Verifica se l'applicazione è attualmente in esecuzione in modalità schermo unico.
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 (app di home).
import { CapacitorAndroidKiosk } from '@capgo/capacitor-android-kiosk';
const { isLauncher } = await CapacitorAndroidKiosk.isSetAsLauncher();console.log('Is launcher:', isLauncher);enterKioskMode
Sottosezione intitolata “impostaModalitàKiosk”Immette modalità kiosk, nascondendo l'interfaccia utente del sistema e bloccando i pulsanti hardware. Inoltre avvia un servizio di keep-alive in primo piano, in modo che l'app sia meno probabile di essere uccisa dal sistema. L'app deve essere impostata come launcher del dispositivo per funzionare efficacemente.
import { CapacitorAndroidKiosk } from '@capgo/capacitor-android-kiosk';
await CapacitorAndroidKiosk.enterKioskMode();exitKioskMode
Sottosezione intitolata “uscitaModalitàKiosk”Esci dalla modalità kiosk, ripristinando l'interfaccia utente del sistema e la funzionalità dei pulsanti hardware. Inoltre fermi il servizio di keep-alive in primo piano avviato in impostaModalitàKiosk().
import { CapacitorAndroidKiosk } from '@capgo/capacitor-android-kiosk';
await CapacitorAndroidKiosk.exitKioskMode();console.log('Exited kiosk mode');setAsLauncher
Sottosezione intitolata “impostaComeLauncher”Apre la schermata di impostazioni del dispositivo di home per consentire all'utente di impostare questa app come launcher. Questo è richiesto per la funzionalità di modalità kiosk completa.
import { CapacitorAndroidKiosk } from '@capgo/capacitor-android-kiosk';
await CapacitorAndroidKiosk.setAsLauncher();// User will be prompted to select this app as the home appsetAllowedKeys
Sottosezione intitolata “impostaChiaviConsentite”Imposta quali tasti hardware sono consentiti di funzionare 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 di tipo
Sottosezione intitolata “Riferimento di tipo”EnterKioskModeOptions
Sottosezione intitolata “Opzioni di modalità kiosk”Flag facoltativi 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
Sottosezione intitolata “Opzioni per tasti consentiti”Opzioni di configurazione per i tasti hardware consentiti 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;}Punto di verità
Sottosezione intitolata “Punto di verità”Questa pagina è generata dal plugin's src/definitions.ts. Riavvia la sincronizzazione quando le informazioni pubbliche API cambiano in fase di sviluppo.
Continua da Getting Started
Sezione intitolata “Continua da Getting Started”Se stai utilizzando Getting Started per pianificare dashboard e API operazioni, connettilo con Utilizza @capgo/capacitor-android-kiosk per la capacità nativa in Utilizza @capgo/capacitor-android-kiosk per la dettaglio di implementazione in API Overview per la dettaglio di implementazione in API Overview Introduzione per i dettagli di implementazione in Introduzione API Chiavi per i dettagli di implementazione in API Chiavi, e Dispositivi per i dettagli di implementazione in Dispositivi.