Getting Started
セットアップのプロンプトをコピーして、インストールの手順とこのプラグインのフルマークダウンガイドを含む。
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.
インストール
「インストール」のセクションbun add @capgo/capacitor-android-kioskbunx cap syncインポート
「インポート」を選択import { CapacitorAndroidKiosk } from '@capgo/capacitor-android-kiosk';APIの概要
「APIの概要」を選択isInKioskMode
「isInKioskMode」を選択現在、キオスクモードで実行されているかどうかを確認します。
import { CapacitorAndroidKiosk } from '@capgo/capacitor-android-kiosk';
const { isInKioskMode } = await CapacitorAndroidKiosk.isInKioskMode();console.log('Kiosk mode active:', isInKioskMode);isSetAsLauncher
「isSetAsLauncher」を選択アプリがデバイスのホームアプリとして設定されているかどうかを確認します。
import { CapacitorAndroidKiosk } from '@capgo/capacitor-android-kiosk';
const { isLauncher } = await CapacitorAndroidKiosk.isSetAsLauncher();console.log('Is launcher:', isLauncher);enterKioskMode
「enterKioskMode」を選択キオスクモードに切り替え、システムUIを非表示にしてハードウェアボタンをブロックします。 また、前景のキープアライブサービスを開始して、アプリがシステムによって殺される可能性を低くします。 アプリは、有効な動作を実現するには、デバイスのホームアプリとして設定する必要があります。
import { CapacitorAndroidKiosk } from '@capgo/capacitor-android-kiosk';
await CapacitorAndroidKiosk.enterKioskMode();exitKioskMode
「exitKioskMode」セクションキオスクモードを終了し、通常のシステムUIとハードウェアボタンの機能を復元します。 また、enterKioskMode()で開始した前景のキープアライブサービスも停止します。
import { CapacitorAndroidKiosk } from '@capgo/capacitor-android-kiosk';
await CapacitorAndroidKiosk.exitKioskMode();console.log('Exited kiosk mode');setAsLauncher
「setAsLauncher」セクションデバイスのホーム画面設定を開き、ユーザーにこのアプリを起動アプリとして設定できるようにします。 これは、キオスクモードの完全な機能を実現するために必要です。
import { CapacitorAndroidKiosk } from '@capgo/capacitor-android-kiosk';
await CapacitorAndroidKiosk.setAsLauncher();// User will be prompted to select this app as the home appsetAllowedKeys
「setAllowedKeys」セクションキオスクモードで機能する許可されたハードウェアキーのセットを設定します。 デフォルトでは、キオスクモードではすべてのハードウェアキーの機能がブロックされます。
import { CapacitorAndroidKiosk } from '@capgo/capacitor-android-kiosk';
// Allow volume keys onlyawait CapacitorAndroidKiosk.setAllowedKeys({ volumeUp: true, volumeDown: true, back: false, home: false, recent: false});「型の参照」セクション
Copy to clipboardEnterKioskModeOptions
「EnterKioskModeOptions」セクションキオスクモードのオプションのためのオプション 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
「AllowedKeysOptions」セクションキオスクモードで許可されたハードウェアキーの設定
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;}真実の源
「真実の源」セクションこのページはプラグインの設定から生成されます。 公開 __CAPGO_KEEP_0__ がアップストリームで変更された場合に再度 Sync を実行してください。 src/definitions.ts. Re-run the sync when the public API changes upstream.
「Getting Started」から続けて
「AllowedKeysOptions」セクションCapgoを使用している場合 Getting Started APIと連携することで、ダッシュボードとAPIの操作を計画できます。 capgo/capacitor-android-kioskを使用して、@capgo/capacitor-android-kioskのネイティブ機能を実装します。 for the native capability in Using @capgo/capacitor-android-kiosk, APIの実装詳細については、APIの概要を参照してください。 for the implementation detail in API Overview, 実装詳細については、概要を参照してください。 __CAPGO_KEEP_0__のキー APIの実装詳細については、APIのキーを参照してください。 for the implementation detail in API Keys, and Devices デバイスの実装詳細について。