# 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
```sh
npm install expo-wake-lock
```

## Configuration (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 prebuild
```

## Usage

```sh
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:

```xml
<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
