3

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.

Domen Jakofčič
  • 626
  • 1
  • 8
  • 24

3 Answers3

4

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

roetnig
  • 268
  • 2
  • 11
  • I already read documentation you linked, but didn't find answer for question. Did you test this? – Domen Jakofčič Jan 05 '17 at 12:52
  • Yes. And other users mention it: " Doze mode will only work if the device is lying still and none of the sensors are triggered. Which means only when your phone is lying on a table, will the Doze mode stop the background processes. But if the phone is in your pocket or lying idle on the car’s dashboard, there will be no battery saving even though you are not actually using the phone." [Guiding Tech:How to Force the Doze Mode on Android Marshmallow Devices](http://www.guidingtech.com/58755/force-doze-mode-android-marshmallow) – roetnig Jan 10 '17 at 15:08
  • Another reference: "For Doze to kick in, your phone needs to be sitting still with the screen off, and not connected to a charger. That means no moving around and nudging the gyro or other motion sensors, no touching the screen or the buttons and no waving your hand around in front of it if you're using a phone like the new phones .. that have motion detection on the front bezel. Set it down, and leave it alone." [Android Central: What is Doze, how do I use it and what does it do?](http://www.androidcentral.com/inside-marshmallow-what-doze-how-do-i-use-it-and-what-does-it-do) – roetnig Jan 10 '17 at 15:30
  • On my Android P it is not sufficient to move the phone (e.g. shake it) to make it exit Doze. I need to turn the screen on. I guess the answers from Shinoo Goyal and Rajat Sharma are more up to date. – Franco Nov 24 '20 at 22:34
  • Entering or exiting doze mode aren't the same. We were talking about entering doze mode. And it doesn't enter doze mode unless stationary. – roetnig Dec 02 '20 at 12:21
2

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

Rajat Sharma
  • 502
  • 4
  • 8
  • 17
2

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.

Shinoo Goyal
  • 601
  • 8
  • 10