Overview
Releases a previously acquired wake lock. This allows the Android system to suspend the CPU when idle. Always call this method when your background work is complete to preserve battery life.Returns
Promise resolving to
true if the wake lock was successfully released, false if no wake lock was held or release failed.Platform Behavior
| Platform | Behavior |
|---|---|
| Android | Releases the CPU wake lock if one is held. If no wake lock is held, returns true without error. Clears the internal wake lock reference. |
| iOS | No-op that returns true immediately. |
Important Notes
- Always Release: Call
releaseWakeLock()after your background work is complete to avoid draining battery. - Safe to Call: It’s safe to call this method even if no wake lock is held - it will return
true. - Use Finally Blocks: Consider using
finallyblocks to ensure wake locks are always released. - One-to-One Mapping: Each
acquireWakeLock()call should have a correspondingreleaseWakeLock()call.
When to Call
✅ Do callreleaseWakeLock() when:
- Background work is complete
- An error occurs during background processing
- The component unmounts
- The app enters the background (if work is complete)
releaseWakeLock() when:
- Background work is still ongoing
- You haven’t called
acquireWakeLock()first
Example Usage
Basic Usage
With Try-Finally
In a React Component
With Error Handling
Checking Before Release
Related APIs
acquireWakeLock()- Acquire a wake lockisWakeLockHeld()- Check if wake lock is held

