--- description: 'Detect the Android 12+ battery restrictions that block the foreground service the player needs, and prompt the listener to fix their settings.' --- # Battery On Android 12+, if the OS has put your app under battery restrictions, it **blocks the foreground service** the player needs to start audio in the background. So when a Bluetooth device or car head unit tries to resume playback while your app is killed, nothing happens. This feature detects that block and lets you prompt the user to fix their battery settings. ::: warning Android only This is an **Android-only** concern (Android 12+ foreground-service limits). On iOS every getter/hook here is inert: `getBatteryWarningPending()` is always `false`, `getBatteryOptimizationStatus()` is always `'unrestricted'`, the events never fire, and `dismissBatteryWarning()` / `openBatterySettings()` are no-ops. So you can render the banner below unconditionally: it never shows on iOS. ::: ## The warning banner A warning becomes **pending** when a background resume is actually blocked. The block happens while your app is killed, so the library saves the warning and you see it the next time the app opens. It stays pending across launches until it clears. Show a banner only while `pending` is true, offering to open settings or dismiss. [`useBatteryWarning()`](/api/features/battery/#usebatterywarning) bundles everything you need: ```tsx import { View, Text, Button } from 'react-native' import { useBatteryWarning } from 'react-native-audio-browser' function BatteryWarningBanner() { const { pending, status, dismiss, openSettings } = useBatteryWarning() if (!pending) return null return ( Playback was blocked by battery settings ({status}).