Doze has been bringing great benefit for my aging Nexus 5. But sadly, its presence also marks an end for my WhatsApp Web experience; since their "web" app is actually just a mere "interface" and still requires the phone to be actively connected to the Internet.

As we all know, Doze puts one's phone into a stand-by state where every unnecessary connection is halted. This means it will also halt the WhatsApp app in my phone (and thus in my computer's browser).

Now, is there a way to exclude WhatsApp from Doze? I mean, is something like that possible?

p.s., I prefer a non-rooted approach to this problem, but should rooting be my only option, so be it.

  • Hi! Please read How do I ask a good question? Did you thoroughly search/research for an answer before asking your question? Tell us what have you tried so far and why it didn't meet your needs? This demonstrates that you've taken the time to try to help yourself and it saves us from reiterating obvious answers. – Firelord Nov 17 '15 at 18:09
  • To be honest, I don't see a point in your argument: I tried searching but it yields no results. I admit that I didn't try anything prior to asking this question apart from the basic digging into the settings; hence why I asked this question. Looking from the votes, it seems useful for quite a few people; it obviously is for me. – ridsatrio Nov 17 '15 at 18:18
  • It's immaterial to me at the moment whether you see a point in my argument or not. I voted on your question and I felt the need to justify my vote. That's all I did. My argument and vote are not affected by the amount of votes currently retained by the post. Instead, I only judge the content and take action. Please avoid arguing further, should you find a need to do that. Use flags for moderation attention requiring clean-up, if feels necessary. – Firelord Nov 17 '15 at 18:21
  • 2
    Well, if that's the case then let me thank you for taking the time to vote. Do note, however, that a question might deemed "not good enough" by a certain standard while it could be proven useful for people who are in need. And in the end, the usefulness of a content is what actually matters in a site dedicated to help people; not how much it follows a certain standard. – ridsatrio Nov 17 '15 at 18:31
up vote 16 down vote accepted

This answer is based off my Nexus 9 on MRA58K. It should be similar for any app.

Follow the steps as given below:

  1. Go to Settings → Battery

  2. Tap on the top right 3-dot menu, and choose Battery Optimisation.

  3. There should be a dropdown below the actionbar on the top left, choose All Apps from the list.

  4. Find your app in the list (in this case, Whatsapp)

  5. Tap on it. You will get a popup with 2 options, Optimise and Don't Optimise

  6. Optimise should be selected by default.

  7. Select "Don't Optimise", and press "Done" below.

  8. That's it. I hope it works for you.

  • 1
    @ridsatrio did this fix the issue for you? I still get "your phone is disconnected" when my screen turns off and the phone goes into Doze even though WhatsApp is marked "Not optimized" – swrobel Nov 18 '15 at 0:19
  • 1
    @swrobel that might be due to a number of causes other than Doze. You might as well check through your Wi-Fi and data settings to check if there aren't any issues there. – Tamoghna Chowdhury Nov 18 '15 at 4:05
  • If this doesn't work for you, I assume that you, like me, switch to Wi-Fi only and disable data. The problem is that Doze also turns off Wi-Fi, so even if an app like WhatsApp is excluded from Doze, it won't be able to connect. Andriod only re-connects to the Wi-Fi when you turn the screen back on. I notice because I also tend to hook my phone to an amp to listen to Spotify, and after a while it will stop playing because Wi-Fi is turned off. On another forum, I read that excluding "Google Connection Services" from Doze would solve this issue, but I don't see such a service on my phone. – Daniel Saner Mar 31 '16 at 9:52

The instructions provided by Tamoghna are the easiest ones to follow when it comes to doing something from GUI. However, there exists other ways to achieve the goal.

You can use the system service named deviceidle to manipulate the battery optimization for an app. You would need setup in PC. Once you have the latter, execute:

adb shell dumpsys deviceidle whitelist +PACKAGE

Replace PACKAGE with package name of the app which you intend to exclude from Doze mode. Follow View app's full package name? if you do not know the package name of your app.

To revert changes, replace + with - in the said command and execute it.

An example, performed for Kde Connect app:

IMG

Note that both the GUI and command-line method make changes in the file /data/system/deviceidle.xml. If you're up to the task and have root access, you can edit that file, reboot the device and your app would be found under "Not Optimized" tab of Battery Optimization.

I came to know about that command from this question by user2281606. I was also reading Optimizing for Doze and App Standby - Testing your app with Doze.

  • It appears that certain system packages (such as com.google.android.gms) cannot be removed from whitelist by this method or using GUI. – Firelord Mar 2 '16 at 12:05

If you want your app permanently removed from optimization and if you have root access, you can just add a simple xml-file to your system partition:

Create a *.xml file with any name and add following content:

<?xml version="1.0" encoding="UTF-8"?>
<config>
    <allow-in-power-save package="com.your.package.name" />
    <allow-in-power-save-except-idle package="com.your.package.name" />
</config>

Remount your system partition mount -o remount,rw /system and copy the file to your /system/etc/sysconfig/ folder. You may also remove the preinstalled *.xml files to disable the forced system services.

Your Answer

 
discard

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.