Skip to main content
Battery optimization exemptions allow your app to bypass Doze mode restrictions, enabling more reliable background execution. However, requesting exemptions requires careful consideration of both technical requirements and Google Play policies.

Understanding battery optimizations

By default, all apps are subject to battery optimizations. This means:
  • The system restricts background execution during Doze mode
  • Network access is suspended when the device is idle
  • Wake locks may be ignored
  • Background jobs and alarms are deferred
When an app is exempt from battery optimizations (also called “ignoring battery optimizations”), it can:
  • Access the network during Doze mode
  • Hold partial wake locks that remain effective
  • Execute background work more reliably
  • Receive alarms with less deferral
Battery optimization exemptions were introduced in Android 6.0 (API 23) as part of the Doze mode feature. On earlier Android versions, these APIs are not available and all apps operate without such restrictions.

Checking exemption status

Always check your app’s current exemption status before requesting changes:
The implementation checks this using the Android PowerManager:
On iOS, isIgnoringBatteryOptimizations() always returns true as the concept doesn’t apply in the same way. iOS handles background execution through Background Modes configured in Xcode.

Two methods for requesting exemptions

There are two approaches to guide users toward granting battery optimization exemptions:

Method 1: Direct dialog (restricted)

This method shows a direct “Allow” dialog to the user:
Pros:
  • User-friendly - single tap to approve
  • Faster user experience
Cons:
  • Requires REQUEST_IGNORE_BATTERY_OPTIMIZATIONS permission
  • Subject to strict Google Play policy restrictions
  • Can lead to app rejection if misused
Google Play Policy Requirement:This method uses ACTION_REQUEST_IGNORE_BATTERY_OPTIMIZATIONS, which requires the REQUEST_IGNORE_BATTERY_OPTIMIZATIONS permission. Google Play only allows this for specific app categories. See Acceptable use cases below.

Method 2: Settings list (safe)

This method opens the system’s battery optimization settings list:
The user must then:
  1. Find your app in the list
  2. Tap on it
  3. Select “Don’t optimize” or “Allow”
Pros:
  • No special permissions required
  • Safe for all apps - no Google Play restrictions
  • No risk of policy violations
Cons:
  • Requires more user steps
  • Some users may struggle to find the app in the list
For most apps, use Method 2 (openBatteryOptimizationSettings) to avoid potential Google Play policy issues. Only use Method 1 if your app clearly falls into an acceptable use case category.

Acceptable use cases

If you use requestBatteryOptimizationExemption(), your app must fall into one of these categories to comply with Google Play policies:

Chat, voice, and video apps

Apps requiring real-time messaging or calls where Firebase Cloud Messaging (FCM) high-priority messages are insufficient.

Examples: WhatsApp, Signal, Zoom

Task automation

Apps that schedule and execute automated actions, macros, or workflows on behalf of the user.

Examples: Tasker, IFTTT, automation tools

Health and fitness tracking

Apps that continuously track health metrics, workouts, or activity data in the background.

Examples: Strava, MyFitnessPal, continuous glucose monitors

Device connection and companion apps

Apps that maintain persistent connections to external devices like smartwatches, IoT devices, or medical equipment.

Examples: Wear OS companion app, smart home controllers

Personal safety apps

Apps providing emergency services, SOS features, or location tracking for personal safety.

Examples: Life360, emergency alert systems

VPN and network tools

Apps that provide VPN services, proxies, or require persistent network connections.

Examples: NordVPN, network monitoring tools

If your app does not fit these categories, do not use requestBatteryOptimizationExemption(). Instead, use openBatteryOptimizationSettings() and instruct the user to manually grant the exemption.Violating Google Play policies can result in:
  • App removal from the Play Store
  • Developer account suspension
  • Loss of user trust

Implementation guide

Complete exemption request flow

Here’s a complete implementation that checks status, requests exemption, and handles the result:

For apps with acceptable use cases

If your app qualifies for the direct dialog method:

Permissions required

The library automatically includes the necessary permission in its Android manifest:
This permission is automatically merged into your app’s manifest during the build process. No additional configuration is needed.
The REQUEST_IGNORE_BATTERY_OPTIMIZATIONS permission is not a runtime permission and doesn’t require user approval. However, its usage is monitored by Google Play’s policy enforcement.

Testing exemption behavior

You can verify that battery optimization exemptions work correctly:

1. Check initial state

2. Request exemption

3. Verify change after returning to app

4. Test Doze behavior

With exemption granted, test that your app works during Doze:

Limitations and caveats

1. Exemption doesn’t override Power Save mode

Battery optimization exemptions only affect Doze mode. Power Save (Battery Saver) mode applies system-wide restrictions to all apps, regardless of exemption status:
See the Doze and App Standby page for more details on the difference.

2. OEM restrictions still apply

Standard Android battery optimization exemptions don’t prevent OEM-specific battery management from killing your app. Manufacturers like Xiaomi, Huawei, and Samsung have additional battery optimization layers:
See the OEM Restrictions page for comprehensive guidance.

3. User can revoke exemption

Users can manually revoke battery optimization exemptions at any time through Settings. Always check status before critical operations:

4. Android version differences

Battery optimization behavior varies across Android versions:

Best practices

1. Request exemptions only when necessary

Don’t request exemptions during onboarding. Wait until the user activates a feature that requires background execution:

2. Provide clear user education

Always explain why you need the exemption before requesting it:

3. Handle denial gracefully

If the user declines the exemption, provide degraded but functional service:

4. Monitor status changes

Track exemption status throughout the app lifecycle: