コンテンツにジャンプ

Getting Started

GitHub

AIアシストされたセットアップを使用してプラグインをインストールできます。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-keep-awake` plugin in my project.

Manual Setup を使用する場合は、以下のコマンドを実行してプラグインをインストールし、以下のプラットフォーム固有の指示に従ってください。

ターミナルウィンドウ
bun add @capgo/capacitor-keep-awake
bunx cap sync
import { KeepAwake } from '@capgo/capacitor-keep-awake';

画面を暗くしないようにする。

import { KeepAwake } from '@capgo/capacitor-keep-awake';
await KeepAwake.keepAwake();
console.log('Screen will stay awake');

画面の明るさを低くする(常時起動を無効にする)を許可する。

import { KeepAwake } from '@capgo/capacitor-keep-awake';
await KeepAwake.allowSleep();
console.log('Screen can now dim');

現在のプラットフォームで常時起動機能がサポートされているかどうかを確認する。

import { KeepAwake } from '@capgo/capacitor-keep-awake';
const { isSupported } = await KeepAwake.isSupported();
if (isSupported) {
console.log('Keep awake is supported');
}

現在、デバイスが常時起動されているかどうかを確認する。

import { KeepAwake } from '@capgo/capacitor-keep-awake';
const { isKeptAwake } = await KeepAwake.isKeptAwake();
console.log('Is kept awake:', isKeptAwake);

isSupported() メソッドの結果

export interface IsSupportedResult {
/**
* Whether keep awake is supported on the current platform.
*
* @since 1.0.0
*/
isSupported: boolean;
}

IsKeptAwakeResult

起動状態の結果

isKeptAwake() メソッドの結果

export interface IsKeptAwakeResult {
/**
* Whether the device is currently being kept awake.
*
* @since 1.0.0
*/
isKeptAwake: boolean;
}

真実の源

真実の源

このページはプラグインの src/definitions.tsAPI の変更を検知した場合に再度同期を実行してください。

Getting Started から続けて

Getting Started から続けて

Capgoを使用している場合 Getting Started APIと連携して、ダッシュボードとAPIの操作を計画する capgo/capacitor-keep-awakeを使用して Capacitorのネイティブ機能を使用するために@capgo/capacitor-keep-awakeを使用する APIの概要 APIの実装詳細について Capgoの概要 Capgoの実装詳細について API Keys for the implementation detail in API Keys, and Capgoのキーの実装詳細について __CAPGO_KEEP_0__の実装詳細についての情報は、デバイスのページにあります。