Request Battery Optimization Exemption and Other Android Permissions

Battery optimization features introduced in Android 6.0 (Marshmallow) have significantly improved power efficiency, especially for background apps. However, certain applicationsโ€”such as navigation, fitness trackers, messaging, or alarm appsโ€”require uninterrupted background operation. In such cases, developers must request exemption from Android’s battery optimizations and handle additional permissions carefully.

In this article, weโ€™ll walk through how to request exemption from battery optimizations, and provide a complete overview of commonly used Android permissions, with practical advice for requesting and managing them responsibly.


๐Ÿ”‹ How to Request Ignore Battery Optimization on Android

1. Add Permission to AndroidManifest.xml

To request exemption from battery optimizations, your app must declare the following permission in the manifest:

<uses-permission android:name="android.permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS" />

๐Ÿ“ This permission only allows your app to prompt the user to disable battery optimizations. It does not disable optimization by itself.

2. Check Battery Optimization Status in Code

Use the PowerManager API to check if your app is already exempted:

PowerManager pm = (PowerManager) getSystemService(Context.POWER_SERVICE);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
    boolean isIgnoring = pm.isIgnoringBatteryOptimizations(getPackageName());
}

3. Send Intent to Request Exemption

If not already exempt, send the user to the correct settings screen:

Intent intent = new Intent(Settings.ACTION_REQUEST_IGNORE_BATTERY_OPTIMIZATIONS);
intent.setData(Uri.parse("package:" + getPackageName()));
startActivity(intent);

โš ๏ธ Important: This prompt must be shown manually with clear explanation. Google Play policies strictly limit its use to apps with a valid need for background execution.

4. Alternative: Open Battery Optimization Settings Directly

To guide the user without triggering the request popup:

Intent intent = new Intent(Settings.ACTION_IGNORE_BATTERY_OPTIMIZATION_SETTINGS);
startActivity(intent);

โœ… Commonly Used Android Permissions Explained

Managing Android permissions is crucial for app functionality and user trust. Below is a breakdown of popular permissions, categorized by use case.


๐Ÿงญ Location Permissions

Used for apps that require GPS data, like delivery, ride-sharing, or fitness apps.

Manifest Declarations:

<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />

Runtime Check (Android 6.0+):

ActivityCompat.requestPermissions(this,
    new String[]{Manifest.permission.ACCESS_FINE_LOCATION},
    LOCATION_REQUEST_CODE);

Android 10+ requires ACCESS_BACKGROUND_LOCATION if location is needed in the background:

<uses-permission android:name="android.permission.ACCESS_BACKGROUND_LOCATION" />

๐Ÿ“ท Camera & Media Permissions

For apps that take photos, scan QR codes, or record videos.

Manifest Declarations:

<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.RECORD_AUDIO" />

Best Practice:

Always provide a preview or justification before requesting.


๐Ÿ“ Storage Access (Scoped Storage Considerations)

Android 10+ introduced Scoped Storage, limiting unrestricted access to files.

Legacy Access:

<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />

Android 11+ Scoped Storage:

Use MANAGE_EXTERNAL_STORAGE only if absolutely necessary, and with permission from Google Play.

<uses-permission android:name="android.permission.MANAGE_EXTERNAL_STORAGE" tools:ignore="ScopedStorage" />

โš ๏ธ Use Storage Access Framework or MediaStore APIs when possible.


๐Ÿ“ž Phone and SMS Permissions

Used in dialers or apps that verify phone numbers.

Manifest Declarations:

<uses-permission android:name="android.permission.CALL_PHONE" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />

โš ๏ธ High-risk permissions: Use only when absolutely required. May trigger additional review from Google Play.


๐Ÿ•“ Background Services & AlarmManager

Apps that need to perform tasks even when not in foreground.

Common Use Cases:

  • Messaging apps
  • Fitness or health trackers
  • Alarm and reminder apps

Permissions & Settings:

  • Use ForegroundService with notification
  • Consider JobScheduler, WorkManager, or AlarmManager.setExactAndAllowWhileIdle()
  • Use REQUEST_IGNORE_BATTERY_OPTIMIZATIONS cautiously

๐Ÿ“œ Best Practices for Android Permissions

  1. Request permissions at runtime only when needed.
  2. Provide rationale dialogs before showing system permission dialogs.
  3. Handle denial gracefully โ€” don’t crash or block core features unless absolutely necessary.
  4. Follow least privilege principle โ€” only ask for what you need.
  5. Use PermissionChecker or ContextCompat.checkSelfPermission to verify permission state before usage.
  6. Update your privacy policy to reflect permission usage.
  7. Test across Android versions (especially 6.0, 10, 11, 13) for behavior changes.

๐Ÿ”’ Google Play Policy Compliance

Some permissions like MANAGE_EXTERNAL_STORAGE, REQUEST_INSTALL_PACKAGES, or REQUEST_IGNORE_BATTERY_OPTIMIZATIONS are restricted and may lead to app suspension if misused.

โœ… Only request these permissions if your app cannot function properly without them โ€” and be ready to provide justification during Play Store review.


๐Ÿ“ฆ Summary

Requesting permission to ignore battery optimizations is just one part of building a robust and policy-compliant Android app. By understanding how permissions work โ€” and using them responsibly โ€” you can build apps that are not only powerful, but also privacy-conscious and future-proof.

PermissionPurposeRequires Runtime RequestNotes
REQUEST_IGNORE_BATTERY_OPTIMIZATIONSAvoid Doze Mode restrictionsโŒShow settings screen
ACCESS_FINE_LOCATIONGPS accessโœ…Background use needs extra permission
CAMERATaking pictures / videosโœ…Declare and explain to user
MANAGE_EXTERNAL_STORAGEFull file system accessโœ… (Android 11+)Needs Play Store review
CALL_PHONEStart phone callsโœ…High-risk

๐Ÿ“Ž Related Articles


๐Ÿ“ง Need Help?

If you’re building an app that requires background execution or advanced permission handling, our expert Android development team can help with:

  • Compliance reviews
  • Custom service management
  • Battery optimization analysis
  • Publishing and Play Store approvals
This article is inspired by real-world challenges we tackle in our projects. If you're looking for expert solutions or need a team to bring your idea to life,

Let's talk!

    Please fill your details, and we will contact you back

      Please fill your details, and we will contact you back