はじめに
このプラグインのインストール手順とフルマークダウンガイドを含むセットアッププロンプトをコピーする。
Set up this Capacitor plugin in the project.
Use the package manager already used by the project.
Install these package(s): `@capgo/capacitor-keep-awake`
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/keep-awake/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-keep-awakebunx cap syncインポート
インポートimport { KeepAwake } from '@capgo/capacitor-keep-awake';API オーバービュー
API オーバービューkeepAwake
画面消灯防止コピー
import { KeepAwake } from '@capgo/capacitor-keep-awake';
await KeepAwake.keepAwake();console.log('Screen will stay awake');allowSleep
Section titled “sleepを許可する”画面を暗くし、スリープを許可する (常時起動を無効にする).
import { KeepAwake } from '@capgo/capacitor-keep-awake';
await KeepAwake.allowSleep();console.log('Screen can now dim');isSupported
Section titled “サポートされているかどうか”現在のプラットフォームで常時起動機能がサポートされているかどうかを確認する.
import { KeepAwake } from '@capgo/capacitor-keep-awake';
const { isSupported } = await KeepAwake.isSupported();if (isSupported) { console.log('Keep awake is supported');}isKeptAwake
Section titled “常時起動中かどうか”現在、デバイスが常時起動中であるかどうかを確認する.
import { KeepAwake } from '@capgo/capacitor-keep-awake';
const { isKeptAwake } = await KeepAwake.isKeptAwake();console.log('Is kept awake:', isKeptAwake);IsSupportedResult
Section titled “サポートされているかどうか結果”isSupported() メソッドの結果。
export interface IsSupportedResult { /** * Whether keep awake is supported on the current platform. * * @since 1.0.0 */ isSupported: boolean;}IsKeptAwakeResult
「IsKeptAwakeResult」セクションisKeptAwake() メソッドの結果。
export interface IsKeptAwakeResult { /** * Whether the device is currently being kept awake. * * @since 1.0.0 */ isKeptAwake: boolean;}真実の源
セクション「真実の源」このページはプラグインの src/definitions.ts API の上流で公開された場合に再度 Sync を実行してください。
Getting Started から続けて
セクション「Getting Started から続けて」あなたが使用している場合 スタート APIと連携するためにダッシュボードとAPIの運用を計画する @capgo/capacitor-keep-awakeを使用する native capabilityの実装詳細については、@capgo/capacitor-keep-awakeを使用する APIの概要 APIの実装詳細については、APIの概要を参照する 導入 実装詳細については、導入を参照する APIのキー APIのキーと実装詳細については、APIのキーを参照する デバイス 実装詳細については、デバイスを参照する