I have an alarm app which requires to changes battery optimisation settings.
Steps to change battery optimisation settings:
- When App opens it redirects user to Battery optimisation page
- Selects all apps, search for my Alarm App
- Click App and select "Don't optimise"
But the as per my new app requirement, I have to add ADMIN permission to lock the screen after alarm fire. I have refer this link to setup admin permission: How to turn Android device screen on and off programmatically?
But once I make Admin settings ON for my App, I am not able to change Battery Optimisation settings.
Issues:
- If device admin is activate, My App is shown in both list("Not optimised" and "All Apps" app list).
- If device admin is activate, When I click on MyApp it does not show option for selection from "Don't optimise" and "Optimise".
- After I deactivate device admin for my App, then battery optimisation settings starts working and able to select options from "Don't optimise" or "Optimise".
Observation:
- I have also checked other admin app like "Company Portal", "POCO Launcher". These apps also not allowed to change battery optimisation settings.
I have also tried to check admin permission document, but could not find any reference to battery optimisation settings.
Questions:
- Did admin level permission and battery optimisation settings work simultaneously?
- What is the solution which allow to change battery optimisation settings when Admin is on for my App?
- If device admin is activate for My App, will it make battery optimisation settings for My App to "Don't Optimise" by default ?