Overview
Enables a screen wake lock to keep the display on while the app is in the foreground. This is different from CPU wake locks and does NOT keep background tasks running.Returns
Promise resolving to
true if the screen wake lock was enabled, false otherwise.Platform Behavior
Important Notes
- Foreground Only: This keeps the screen awake only while the app is in the foreground. It does NOT replace
acquireWakeLock()for background CPU execution. - Activity Required: On Android, this requires a current Activity. Returns
falseif no Activity is available. - Battery Impact: Keeping the screen on consumes significant battery. Use sparingly and only when necessary.
- Automatic Cleanup: The system automatically clears this when the Activity is destroyed.
Use Cases
✅ Good use cases:- Video playback
- Navigation/maps display
- Reading/viewing content
- Live monitoring dashboards
- Camera preview screens
- Background task execution (use
acquireWakeLock()instead) - When the app is in the background
- Battery-sensitive scenarios
Example Usage
Basic Usage
Video Player Component
Navigation Screen
Conditional Screen Lock
With Error Handling
Comparison with CPU Wake Lock
Related APIs
disableScreenWakeLock()- Allow screen to turn offacquireWakeLock()- Keep CPU running (different purpose)

