Démarrage
Copiez un prompt de configuration avec les étapes d'installation et le guide markdown complet pour ce 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.
Installer
Section intitulée “Installer”Vous pouvez utiliser notre configuration assistée par l'IA pour installer le plugin. Ajoutez les Capgo compétences à votre outil d'IA en utilisant la commande suivante :
npx skills add https://github.com/Cap-go/capgo-skills --skill capacitor-pluginsEnsuite, utilisez la prompt suivante :
Use the `capacitor-plugins` skill from `Cap-go/capgo-skills` to install the `@capgo/capacitor-android-kiosk` plugin in my project.Si vous préférez la configuration manuelle, installez le plugin en exécutant les commandes suivantes et suivez les instructions spécifiques à la plateforme ci-dessous :
bun add @capgo/capacitor-android-kioskbunx cap syncImporter
Section intitulée « Importer »import { CapacitorAndroidKiosk } from '@capgo/capacitor-android-kiosk';API Aperçu
Section intitulée « API Aperçu »isInKioskMode
Section intitulée « isInKioskMode »Vérifie si l'application est actuellement exécutée en mode kiosque.
import { CapacitorAndroidKiosk } from '@capgo/capacitor-android-kiosk';
const { isInKioskMode } = await CapacitorAndroidKiosk.isInKioskMode();console.log('Kiosk mode active:', isInKioskMode);isSetAsLauncher
Section intitulée « isSetAsLauncher »Vérifie si l'application est définie comme l'application de démarrage du dispositif (application d'accueil).
import { CapacitorAndroidKiosk } from '@capgo/capacitor-android-kiosk';
const { isLauncher } = await CapacitorAndroidKiosk.isSetAsLauncher();console.log('Is launcher:', isLauncher);enterKioskMode
Section intitulée « modeKiosque »Active le mode kiosque, masquant l'interface utilisateur système et bloquant les boutons matériel.
import { CapacitorAndroidKiosk } from '@capgo/capacitor-android-kiosk';
await CapacitorAndroidKiosk.enterKioskMode();exitKioskMode
L'application doit être définie comme l'application d'accueil du dispositif pour que cela fonctionne efficacement.Copier dans le presse-papier
import { CapacitorAndroidKiosk } from '@capgo/capacitor-android-kiosk';
await CapacitorAndroidKiosk.exitKioskMode();console.log('Exited kiosk mode');setAsLauncher
Sort du mode kiosque, restituant l'interface utilisateur système normale et la fonctionnalité des boutons matériel.Active également le service de maintenance en avant-plan arrêté dans enterKioskMode().
import { CapacitorAndroidKiosk } from '@capgo/capacitor-android-kiosk';
await CapacitorAndroidKiosk.setAsLauncher();// User will be prompted to select this app as the home appsetAllowedKeys
Section intitulée « definirCommeLanceur »Ouvre l'écran d'accueil du dispositif pour permettre à l'utilisateur de définir cette application comme l'application d'accueil.
import { CapacitorAndroidKiosk } from '@capgo/capacitor-android-kiosk';
// Allow volume keys onlyawait CapacitorAndroidKiosk.setAllowedKeys({ volumeUp: true, volumeDown: true, back: false, home: false, recent: false});Référence de type
Section intitulée « Référence de type »EnterKioskModeOptions
Section intitulée « Options d'entrée en mode kiosque »Drapeaux facultatifs pour 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;}Options de configuration pour les clés de matériel autorisées en mode kiosque.
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;}Source de vérité
Section intitulée « Source de vérité »Cette page est générée à partir du plugin. src/definitions.tsRe-run la synchronisation lorsque les modifications publiques API sont mises à jour en amont.
Continuez de l'interface d'accueil
Titre de la section « Continuez de l'interface d'accueil »Si vous utilisez Interface d'accueil pour planifier l'interface utilisateur et les opérations API, connectez-vous à Utilisation de @capgo/capacitor-android-kiosk pour la capacité native dans l'utilisation de @capgo/capacitor-android-kiosk, API : Présentation pour les détails d'implémentation dans API : Présentation, Introduction pour les détails d'implémentation dans Introduction, API : Clés pour les détails d'implémentation dans les API clés, et Appareils pour les détails d'implémentation dans Appareils.