expo-wake-lock
v1.0.0
Published
Android-only Expo module to acquire and release a partial WakeLock
Maintainers
Readme
expo-wake-lock
Android wake lock support for Expo apps.
Keeps the CPU running while your app is active. Useful for background work, networking, media, or long-running tasks.
Android only.
Installation
npm install expo-wake-lockConfiguration (required)
This module uses a native Android permission and requires a config plugin. Add the plugin to your Expo config:
{
"expo": {
"plugins": ["expo-wake-lock/plugin"]
}
}Then regenerate native code:
npx expo prebuildUsage
import {
acquireWakeLock,
releaseWakeLock,
isWakeLockHeld,
} from "expo-wake-lock"
acquireWakeLock()
// later
releaseWakeLock()
if (isWakeLockHeld()) {
// do something
}Platform behavior
Android: Uses PowerManager.PARTIAL_WAKE_LOCK iOS: No-op (logs a warning) Web: No-op (logs a warning)
Calls are safely guarded — importing or calling this module will not crash on unsupported platforms.
Permissions
On Android, this module requires:
<uses-permission android:name="android.permission.WAKE_LOCK" />This is added automatically by the config plugin.
Notes
Wake locks are not reference-counted
Calling acquire() multiple times has no effect
Always call release() when finished
Misuse will drain battery — use carefully
License
MIT
