Reputation: 1
I am facing issues with Alarm manager so for testing purpose i purposely switched off battery optimization of my mobile but it didn't work) Now I need answer for 2 things:
Upvotes: 0
Views: 62
Reputation: 351
According to this book:
Doze reduces battery consumption when the device is not being used for a long time, by temporarily suspending the background tasks performed by CPU and network calls for apps
When will the device go in doze mode?
Doze mode in an Android device is a state which is satisfied if these three conditions are met:
- If the device screen is off.
- If the user is not using the device for a period of time.
- If the device is in a non-charging state.
So battery optimization has nothing with doze mode.
For the second question:
Standard AlarmManager alarms are temporarily suspended to the next maintenance window. The alarms could be overridden in doze mode by writing this statement in the code:
setAndAllowWhileIdle()
orsetExactAndAllowWhileIdle()
In maintenance window your applications are not suspended.
To be clear how device run maintenance window and doze mode:
Hope this helps.
Upvotes: 1