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 Frameworkor 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
ForegroundServicewith notification - Consider
JobScheduler,WorkManager, orAlarmManager.setExactAndAllowWhileIdle() - Use
REQUEST_IGNORE_BATTERY_OPTIMIZATIONScautiously
๐ Best Practices for Android Permissions
- Request permissions at runtime only when needed.
- Provide rationale dialogs before showing system permission dialogs.
- Handle denial gracefully โ don’t crash or block core features unless absolutely necessary.
- Follow least privilege principle โ only ask for what you need.
- Use
PermissionCheckerorContextCompat.checkSelfPermissionto verify permission state before usage. - Update your privacy policy to reflect permission usage.
- 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.
| Permission | Purpose | Requires Runtime Request | Notes |
|---|---|---|---|
REQUEST_IGNORE_BATTERY_OPTIMIZATIONS | Avoid Doze Mode restrictions | โ | Show settings screen |
ACCESS_FINE_LOCATION | GPS access | โ | Background use needs extra permission |
CAMERA | Taking pictures / videos | โ | Declare and explain to user |
MANAGE_EXTERNAL_STORAGE | Full file system access | โ (Android 11+) | Needs Play Store review |
CALL_PHONE | Start phone calls | โ | High-risk |
๐ Related Articles
- How to Handle Android Runtime Permissions in Kotlin
- Implementing Foreground Services Correctly
- Scoped Storage: Migrating Your Android App for Android 11+
๐ง 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


