prahal mendon
prahal mendon

Reputation: 1

Will my mobile be in Doze mode if my battery optimization of mobile is off?

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:

  1. Will my mobile go to doze mode if my battery optimization of mobile is off ?
  2. How can i give most priority to alarm manager in my code?
    This is battery optimization which is off: This is battery optimization which is off

Upvotes: 0

Views: 62

Answers (1)

peco
peco

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:

  1. If the device screen is off.
  2. If the user is not using the device for a period of time.
  3. 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() or setExactAndAllowWhileIdle()

In maintenance window your applications are not suspended.

To be clear how device run maintenance window and doze mode:

enter image description here

Hope this helps.

Upvotes: 1

Related Questions