Background audio player
Use wake locks to keep the CPU running while playing audio in the background. This prevents the system from suspending your app during playback.Foreground kiosk / Always-on screen
Keep the screen on while your app is in the foreground. Perfect for kiosk applications, digital signage, or dashboards.Screen wake locks only work while the app is in the foreground. For background CPU execution, use
acquireWakeLock() instead.Background location tracking
For reliable background location tracking, you need to request battery optimization exemptions and handle OEM-specific settings.Complete integration example
This example shows a complete React hook that manages battery optimization status and provides a clean interface for your components.Using the hook in your component
The hook automatically refreshes battery optimization status when the app returns to the foreground, ensuring your UI always shows the current state.

