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.
インストール
「インストール」のセクションCapgoのAI-Assisted Setupを使用してプラグインをインストールできます。AIツールにCapgoスキルを追加するには、以下のコマンドを使用してください。
npx skills add https://github.com/Cap-go/capgo-skills --skill capacitor-plugins次のコマンドを使用してください。
Use the `capacitor-plugins` skill from `Cap-go/capgo-skills` to install the `@capgo/capacitor-android-kiosk` plugin in my project.Manual Setup を好みますか?、以下のコマンドを実行して、下記のプラットフォーム固有の手順に従ってプラグインをインストールしてください。
bun add @capgo/capacitor-android-kioskbunx cap syncImport
「Import」のセクション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});タイプ リファレンス
「タイプ リファレンス」のセクションEnterKioskModeOptions
「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;}ソース オブ トゥース
「ソース オブ トゥース」のセクションこのページはプラグインから生成されています。 src/definitions.ts.再度Syncを実行してください。Public APIがアップストリームで変更された場合。
Getting Startedから続けてください。
セクションのタイトルは「Getting Startedから続けてください。」あなたが使用している場合 Getting Started ダッシュボードとAPIの計画と実行を目的とした場合、APIを接続してください。 Using @capgo/capacitor-android-kiosk Using @capgo/capacitor-android-kioskのネイティブ機能のために API Overview API Overviewの実装詳細のために Introduction 実装詳細については、Introductionを参照してください。 API キー 実装詳細については、API キー、 デバイス 実装詳細については、デバイスを参照してください。