Skip to main content

Overview

Checks if a wake lock is currently held by this module. Useful for debugging or updating UI state based on wake lock status.

Returns

isHeld
boolean
Promise resolving to true if a wake lock is currently held, false otherwise.

Platform Behavior

Use Cases

Good use cases:
  • Checking if a wake lock is held before acquiring a new one
  • Updating UI to show active background tasks
  • Debugging wake lock state
  • Preventing duplicate wake lock acquisitions
  • Logging and analytics
Not needed:
  • Before calling releaseWakeLock() (it’s safe to call even if not held)
  • For typical acquire/release patterns (just pair calls appropriately)

Example Usage

Check Before Acquiring

Update UI State

Debugging Helper

Conditional Background Task

Status Display Component

Implementation Details

Android

On Android, this method checks the isHeld property of the PowerManager.WakeLock instance. It returns false if:
  • No wake lock has been acquired
  • The wake lock was released
  • The wake lock timed out

iOS

On iOS, this always returns false since the platform doesn’t support wake locks in the same way. iOS apps should use Background Modes configured in Xcode for background execution.