The Android team during the Android 6 Marshmallow release decided to implement and introduce a new innovative function which is called Doze mode. This function was created to deliver a new fresh breath to the battery drain and generally extend the battery life which was the weak side of the applications. This idea was invented because the system observed that the majority of the mobile apps are using high levels of battery and that costs not only to the battery but generally to the performance also.
photo from developer.android.com
But what is doze mode ? and how does this activate?
Doze mode is the situation that a device gets in during a long time of standby mode. This mode starts to count after the user presses the side button of the android device or by the time that user leaves the device for a long time like at night. After some time the device creates something like a wall and the user doesn't receive notifications regularly except the maintenance windows that appear every 5, 15, 45 minutes and as the time running on doze mode the maintenance windows are becoming even shorter during the long time periods. The user does not need to do anything to become on Doze mode because the device handles the control of and the efficient system puts almost all the app to the background activity until the user makes an action to the device and awakens all the apps again.
Does the Doze mode affect all the apps or just some of them?
The Doze mode does not affect all the apps! There are apps which are huge from the popularity side and the users need to get notifications for these. Apps like the giant which is called Whatsapp, can't just go for a nap in order to save energy. Whatsapp users are over a billion so imagine how big the problem will be if an app like that stops working when a user doesn't touch the device.
How can users avoid getting on Doze mode?
Well the first and obvious option is to use the device all the time. But this can't be a realistic option, there is another way to keep your favorite apps alive and they will continue to inform you regarding actions. The steps to avoid becoming in doze mode your favorite apps are: Settings > Apps & notifications > Advanced > Special app access > Battery optimization. In the drop down, select all apps. Tap an app, select Don't optimize. After these steps the app will continue to notify you even if the device is not in action for many hours.
Problems that can be faced during a location update request during the Doze mode
As we mentioned above when the device is on doze mode the only hope for getting notifications is the maintenance windows. But even these are getting rarer and rarer during the time. This is the biggest problem that we faced on the coopz social app because this affects directly the location update also which is a core function of the app while you get informed for distance from other users and receive entry notifications for created locations. So the doze mode created from the very beginning a brain teaser because the app couldn't send or receive the gps signals regularly but only during the maintenance windows!
How does Android 10 handle background activities ?
On Android 10 the privacy goes to another level. The apps can no longer run in the background without the user permission. This probably was decided from the Android team in order to deliver the steering wheel of the device to the users and they will be more responsible for their privacy from now on. Especially on location sharing apps the system directly informs the user if the user wants to allow these location permissions to run “always” or ”only while using the app” or “never on this device”. This is the future of privacy and background activities and how Android will build to the next android versions also.
How do we solve the problem of battery drain and sending accurate location updates on coopz?
We as the coopz team faced the doze mode during the development of the coopz location alerts. The biggest issue was that we were not able to send alert notifications in the app because the doze mode was creating a wall on these since the coopz alerts were not excluded from the list of the sleeping apps. By the testing time we observed that when the devices were in use or standby mode for maximum 15 min, the notifications worked very well and accurately but since the 15 minutes were becoming 16 or even more, then the notifications were going to sleep like the device owner. So we had to find a solution on this 15 minute rule and we had to find out how to break through and awake the user’s device every time that the app needed to notify the user: Push Notifications!
Push notifications were the solution to our problem! The solution may sound easy and simple but is definitely not. Our developer team worked in a very deep strategy and implemented several algorithms to apply the push notifications which awake the doze mode and the users receive all the necessary messages and alerts which are the core and proud part of this app. The push notifications were the key to notify the user to make the action and open the app and be directly informed regarding “likes, location entries, favorites etc” of the other users to the message centre.
The Doze mode is a great tool for the users but at the same time is a great challenge for the applications and the support teams. May the doze mode reduce the battery drain but at the same time the users need to stay updated. We tried and achieved a way to combine with an efficient way the reduction of battery drain and at same time to keep always updated our coopz community.