@capacitor-community/keep-awake
TypeScript icon, indicating that this package has built-in type declarations

5.0.0 • Public • Published


Keep Awake

@capacitor-community/keep-awake

⚡️ Capacitor plugin to prevent devices from dimming or locking the screen.


Maintainers

Maintainer GitHub Social
Kevin Boosten kevinboosten @kevinboosten
Robin Genz robingenz @robin_genz

Installation

npm install @capacitor-community/keep-awake
npx cap sync

Configuration

No configuration required for this plugin.

Demo

A working example can be found here: robingenz/capacitor-plugin-demo

Usage

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

const keepAwake = async () => {
  await KeepAwake.keepAwake();
};

const allowSleep = async () => {
  await KeepAwake.allowSleep();
};

const isSupported = async () => {
  const result = await KeepAwake.isSupported();
  return result.isSupported;
};

const isKeptAwake = async () => {
  const result = await KeepAwake.isKeptAwake();
  return result.isKeptAwake;
};

API

keepAwake()

keepAwake() => Promise<void>

Prevent the device from dimming the screen.


allowSleep()

allowSleep() => Promise<void>

Allow the device to dim the screen.


isSupported()

isSupported() => Promise<IsSupportedResult>

Whether keep awake is supported or not.

Returns: Promise<IsSupportedResult>


isKeptAwake()

isKeptAwake() => Promise<IsKeptAwakeResult>

Check if the device is kept awake.

Returns: Promise<IsKeptAwakeResult>


Interfaces

IsSupportedResult

Prop Type
isSupported boolean

IsKeptAwakeResult

Prop Type
isKeptAwake boolean

Changelog

See CHANGELOG.md.

License

See LICENSE.

Readme

Keywords

Package Sidebar

Install

npm i @capacitor-community/keep-awake

Weekly Downloads

9,769

Version

5.0.0

License

MIT

Unpacked Size

33.9 kB

Total Files

26

Last publish

Collaborators

  • ionicjs
  • danielprrazevedo
  • nkalupahana
  • dtarnawsky
  • ryaa
  • dallasjames
  • tafelnl
  • thegnuu
  • pbowyer
  • capcombot
  • jcesarmobile
  • maxlynch
  • mhartington
  • it_mike_s
  • byrds
  • rdlabo
  • priyankpatel
  • dwieeb
  • stewan
  • arielhernandezmusa
  • jeepq
  • start9keagan
  • boosten
  • nklayman
  • ihadeed
  • ckgaparajita
  • jpender
  • nhyatt
  • pwespi
  • epicshaggy
  • thomasvidas
  • robingenz
  • diachedelic
  • johnborges
  • tobyas
  • elylucas
  • larsmikkelsen
  • giodimiliaionic
  • brownoxford
  • mrbatista
  • bazuka5801
  • hemang