본문으로 바로가기
플러그인으로 돌아가기
@capgo/capacitor-keep-awake
튜토리얼
github.com/Cap-go에 의해

Keep Awake

비디오 플레이어, 네비게이션 및 프레젠테이션과 같은 장치 화면을 어둡게 하거나 수면 상태로 유지하는 것을 방지합니다.

가이드

__CAPGO_KEEP_2__에서 Keep Awake에 대한 튜토리얼

@capgo/capacitor-keep-awake를 사용하여

Capacitor에서 Keep Awake 플러그인을 사용하여 디바이스 화면을 어둡게 하거나 잠들지 않도록 방지합니다.

설치

bun add @capgo/capacitor-keep-awake
bunx cap sync

이 플러그인은 다음을 제공합니다.

  • keepAwake - 디바이스가 화면을 어둡게 하지 않도록 방지합니다.
  • allowSleep - 디바이스가 화면을 어둡게 할 수 있도록 허용합니다 (keep awake 비활성화).
  • isSupported - 현재 플랫폼에서 keep awake 기능이 지원되는지 확인합니다.
  • isKeptAwake - 디바이스가 현재 keep awake 상태인지 확인합니다.

예시 사용법

keepAwake

디바이스가 화면을 어둡게 하지 않도록 방지합니다.

import { KeepAwake } from '@capgo/capacitor-keep-awake';

await KeepAwake.keepAwake();
console.log('Screen will stay awake');

allowSleep

디바이스가 화면을 어둡게 할 수 있도록 허용합니다 (keep awake 비활성화).

import { KeepAwake } from '@capgo/capacitor-keep-awake';

await KeepAwake.allowSleep();
console.log('Screen can now dim');

isSupported

현재 플랫폼에서 keep awake 기능이 지원되는지 확인합니다.

import { KeepAwake } from '@capgo/capacitor-keep-awake';

const { isSupported } = await KeepAwake.isSupported();
if (isSupported) {
  console.log('Keep awake is supported');
}

isKeptAwake

디바이스가 현재 keep awake 상태인지 확인합니다.

import { KeepAwake } from '@capgo/capacitor-keep-awake';

const { isKeptAwake } = await KeepAwake.isKeptAwake();
console.log('Is kept awake:', isKeptAwake);

전체 참조

Using @capgo/capacitor-keep-awake

If you are using @__CAPGO_KEEP_0__/__CAPGO_KEEP_1__-keep-awake Using @capgo/capacitor-keep-awake to plan native media and interface behavior, connect it with @__CAPGO_KEEP_0__/__CAPGO_KEEP_1__-keep-awake @capgo/capacitor-keep-awake for the implementation detail in @capgo/capacitor-keep-awake, for the implementation detail in Getting Started, @__CAPGO_KEEP_0__/__CAPGO_KEEP_1__-keep-awake Using @__CAPGO_KEEP_0__/__CAPGO_KEEP_1__-live-activities for the native capability in Using @capgo/capacitor-live-activities Getting Started for the implementation detail in Getting Started, @capgo/capacitor-keep-awake @capgo/capacitor-live-활동 for the implementation detail in @capgo/capacitor-live-activities, and Using @capgo/capacitor-비디오 플레이어 for the native capability in Using @capgo/capacitor-video-player.