Domen Jakofčič
Domen Jakofčič

Reputation: 636

Android Doze mode

Documentation says:

If a user leaves a device unplugged and stationary for a period of time, with the screen off, the device enters Doze mode. In Doze mode, the system attempts to conserve battery by restricting apps' access to network and CPU-intensive services. It also prevents apps from accessing the network and defers their jobs, syncs, and standard alarms.

What exactly stationary mean? Does phone go into Doze if it is stationary in a car that is moving? I'm developing an app that send location update to a server and if phone go into Doze mode while moving in car that can't be done.

Upvotes: 3

Views: 4103

Answers (3)

Shinoo Goyal
Shinoo Goyal

Reputation: 621

In case of Android M doze mode will not get kicked in if the device is in moving car.

But in Android N, a light doze mode has been introduced that does not require the device to be completely stationary or wait as long to activate.It starts shortly after both the screen is off and the device is not charging, waiting only a couple minutes before applying the restrictions just to make sure the user has stopped using their phone.

In case,phone is Android N it may go into light doze mode.

Upvotes: 2

Rajat Sharma
Rajat Sharma

Reputation: 522

It should be noted that Android N has extended doze mode further. Here the device doesn't need to be 'absolutely stationary' for a 'lighter' version of doze - that allows wake locks but restricts network access - to kick in.

The principal is that to truly take advantage of this, android needs to conserve battery if the phone is in a user's pocket where it is 'unused' but may not be stationary.

The original Marshmallow 'deep-doze' is still very much present in N so once the phone is stationary for a good amount of time [screen off + not being charged are already met criteria] it will go into the original doze where wifi scans and gps scans [location updates], wake locks, job schedulers, sync adapters, and network access is restricted.

To answer your question for location updates, android has a fine motion detecting sensor which ensures that the device is stationary w.r.t earth before diving into the deeper version of doze. So for this particular use case you should be good to go but you should still use the newly introduced Job scheduler api for batched updates. I am sure fetching location is one aspect, you want to upload it to your servers as well. Network access is restricted in both versions of doze modes.

references https://plus.google.com/+AndroidDevelopers/posts/gwA68kaVJQ8 https://www.youtube.com/watch?v=VC2Hlb22mZM

Upvotes: 2

roetnig
roetnig

Reputation: 268

Stationary means literally stationary, no gyro activity, screen off, not connected to charger. As far as the car is moving, the phone will not enter Doze mode.

Android developers: Optimizing for Doze and App Standby

Upvotes: 4

Related Questions