1. Download our Official Android App: Forums for Android!

Support Nougat: can Doze really be disabled? Otherwise push email won't work

Discussion in 'Android Help' started by cdl, Dec 27, 2016.

  1. cdl

    cdl Android Enthusiast
    Thread Starter
    Rank:
     #558
    Points:
    43
    Posts:
    430
    Joined:
    Feb 4, 2010

    Feb 4, 2010
    430
    47
    43
    The Doze functionality introduced by Marshmallows broke push email notifications, because only high-priority GCM (google cloud messaging) notifications can wake a phone from doze. Whatsapp messages are high priority GCMs, but, AFAIK, no email client exists which relies on high priority GCMs, which means that no push email whatsoever works when the phone is in Doze.

    On the web there are countless how-tos describing how to whitelist certain apps exempting them from Doze, but the exemption is only partial: at least with Marshmallows, whitelisted email clients will not push email when the phone is in Doze. I had a very detailed post here: http://androidforums.com/threads/ma...x-is-preventing-doze-with-macrodroid.1058445/ explaining all the details.

    My question is: is there a solution with Nougat? Can an app really be whitelisted in Nougat and be really exempted from Doze? Is there a way to make push email work with Nougat's Doze?
    Rooting is not an option for me, because the app I use for work email (Good, acquired by Blackberry) does not work on rooted phones.

    Breaking push email really leaves me speechless! I can understand most non-technical users would prefer longer battery life, but I cannot understand why there isn't an option to disable Doze for those who absolutely need instant push email notifications, e.g. for work.

    Thanks!
     

    Advertisement

  2. chanchan05

    chanchan05 The Doctor
    Rank:
     #23
    Points:
    1,108
    Posts:
    14,813
    Joined:
    Jun 30, 2011

    Jun 30, 2011
    14,813
    4,536
    1,108
    Male
    You don't even need to use MacroDroid in Marshmallow. Just go to settings>battery>details>more>optimize>and turn off optimization for apps you don't want dozing.
     
  3. cdl

    cdl Android Enthusiast
    Thread Starter
    Rank:
     #558
    Points:
    43
    Posts:
    430
    Joined:
    Feb 4, 2010

    Feb 4, 2010
    430
    47
    43
    No! Like I wrote in my post, the many websites which explain how to whitelist certain apps are wrong, because the exemption is only partial. A whitelisted email app will NOT push email when the phone is in doze. I explained all the details in the other thread I linked above.
     
  4. chanchan05

    chanchan05 The Doctor
    Rank:
     #23
    Points:
    1,108
    Posts:
    14,813
    Joined:
    Jun 30, 2011

    Jun 30, 2011
    14,813
    4,536
    1,108
    Male
    I've already read that thread. And in my experience all your assumptions are false as far as I can tell. I have Aggressive Doze and Doze on the go active, and still receive IMs via apps set to ignore Doze on time. And Doze records on Greenify can attest to me receiving those notifications while the phone is on Doze. In fact as far as I can tell, those notifications seem to bring the phone out of Doze. If your phone isn't exempting apps from Doze properly, I'd expect it more a problem on the app itself, as you also noted on that previous post. Google's own apps (like Gmail and Inbox), work properly. Hence, it's not an issue at all. It's an issue with how those apps work. Based on your own research, Aquamail doesn't send high priority notifications. Why? That's not a problem of Doze. That's an app developer's problem. If other devs can do it, why not them? It's a matter of getting the devs to code the notifications properly, not an issue with Doze itself. Google gave them the way how to work with it. It's up to the devs to do it properly.
     
    tube517 and BustaLime like this.
  5. cdl

    cdl Android Enthusiast
    Thread Starter
    Rank:
     #558
    Points:
    43
    Posts:
    430
    Joined:
    Feb 4, 2010

    Feb 4, 2010
    430
    47
    43

    You have not read the other thread carefully, then, because the point was about emails, not IMs. IMs work with Doze? Yes, of course. Google has decided that IMs are higher priority than emails, and has structured its GCM accordingly. Their official documentation mentions as much: https://developers.google.com/cloud-messaging/concept-options#setting-the-priority-of-a-message

    Why it has decided that it should be so, only they know, and why users have no option to change this is beyond me, since that's an idiotic, dictatorial Apple-like my-way-or-the-highway approach. For example, there are people for whom instant push email notifications are more important than instant IMs.

    The point is not that a phone doesn't exempt apps from Doze properly; the point is that Google has conceived Doze so that very few things, namely high-priority GCM notifications, phone calls and alarms can wake a phone from Doze; Google has specifically conceived Doze so that a whitelisted email client CANNOT wake the phone from Doze to check for emails, i.e. Doze breaks push email - unless push is via a server implementation, as opposed to, say, IMAP idle, which relies on GCM and which sends high-priority notifications. This is mentioned very clearly in Google's official documentation, which I had linked in my other thread.

    You mention that gmail and inbox work correctly. Could you please elaborate on this? Last time I checked, neither sends high-priority GCM notifications. Has this changed? Is there a way to make push email work correctly with Doze? If you know of such a way, any colour would be most appreciated as I'm very interested in the topic. Have you specifically verified that gmail and inbox can receive emails while the phone is in doze? If you have, that's the first I hear of it, so, like I said, I am most interested in any colour you may have; in fact, the web is full of complaints of gmail notifications not working properly while in doze. Are you sure that it wasn't something else (e.g. a whatsapp message or a clock alarm going off) that caused the phone to wake from doze?

    In fact, Google's official documentation mentions that google will not grant exemptions from Doze's (flawed and idiotic) power saving feature for email apps which do not use GCM: https://developer.android.com/training/monitoring-device-state/doze-standby.html

    This comments suggests you have some confusion on the different systems of push email. K-9 mail and Aquamail rely on imap idle; Google has decided that imap idle is not to work under doze, so the only email clients which can have functional push email notifications when in doze are those with a centralised server-side implementation which relies on high-priority GCM notifications. In other words: with imap idle, the client connects to the server and tries to keep the connection alive listening to new emails. With GCM, you need a centralised server which connects to your email server, listens to new emails, and sends a GCM notification to your phone when a new email arrives. This is almost the same concept as that of a Blackberry server.
    So, no, it is absolutely not correct to say that Goggle gave them [the developers] a way to work with it.

    Apple fanboys like to repeat that iOS doesn't support imap idle because of the battery drain, but in my 6 years of using imap idle on android on multiple devices I have never experienced battery drain; in fact, I have always found the difference in battery use with imap idle on vs off absolutely negligible. I appreciate that a server-side implementation may drain even less battery, but I don't like this solution because it means giving a third party, other than my email provider, access to my inbox, and I don't trust privacy policies and marketing guff claiming that they don't look at my emails.

    Finally, as of now, AFAIK no email client exists which sends high-priority GCM notifications. Why that is I don't know; however, setting up a server which listens to your emails and sends GCM notifications (regardless of priority) to your phone has a cost (who maintains and pays for this server?) whereas a system like imap idle, which does not need a separate server to check your emails, does not.
     
  6. chanchan05

    chanchan05 The Doctor
    Rank:
     #23
    Points:
    1,108
    Posts:
    14,813
    Joined:
    Jun 30, 2011

    Jun 30, 2011
    14,813
    4,536
    1,108
    Male
    AFAIK Google, Outlook, and other first party apps use GCM. Have you checked them? It's an issue of the notification being flagged as priority.

    If you really want to not use Gmail, or insist on using a third party app, the issue is again simply fixed without needing to disable Doze. Major email clients nowadays like Gmail are able to send you text notifications as soon as you receive an email. Hence all you need is to activate it. Once you get an email, you will receive an SMS a few secs later. SMS obviously goes through Doze.
     
  7. lvt

    lvt Android Expert
    Rank:
     #97
    Points:
    283
    Posts:
    1,541
    Joined:
    Jan 30, 2013

    Jan 30, 2013
    1,541
    550
    283
    Male
    Paris <--> Taipei
    Don't use Doze, buy a backup battery pack.

    I'm not joking, it's the solution I currently use.
     
  8. cdl

    cdl Android Enthusiast
    Thread Starter
    Rank:
     #558
    Points:
    43
    Posts:
    430
    Joined:
    Feb 4, 2010

    Feb 4, 2010
    430
    47
    43
    Like I said, I know of email apps which use GCM, but I do not know a single app which uses high-priority GCM notifications. Do you know of one? I, as the user, cannot change this.

    The point about SMS notification is not ideal, but interesting. Could you elaborate a bit? Fastmail used to have something like this, but SMS were not free, and I think it's been discontinued since very few people were using it.

    Thanks.
     
  9. cdl

    cdl Android Enthusiast
    Thread Starter
    Rank:
     #558
    Points:
    43
    Posts:
    430
    Joined:
    Feb 4, 2010

    Feb 4, 2010
    430
    47
    43
    How do you disable doze? I cannot root my phone or my work email app won't work.
    In the other thread I showed my workaround with Macrodroid (get it to do something every 50 minutes or so, to prevent doze from kicking in) but with Nougat this wouldn't work, as with Nougat doze kicks in almost straight away.
    There is an app called Disable Doze but I don't know how it works.
     
  10. chanchan05

    chanchan05 The Doctor
    Rank:
     #23
    Points:
    1,108
    Posts:
    14,813
    Joined:
    Jun 30, 2011

    Jun 30, 2011
    14,813
    4,536
    1,108
    Male
    It's not a service of an email app. Basically you go to the settings of the email provider on a PC browser, then turn on SMS alerts. Gmail's alerts are free.

    Interestingly, as I was looking for a premade tutorial for Gmail, I saw one that claimed to work for any email provider. You may want to check it out.

    http://www.howtogeek.com/210956/how-to-configure-automatic-text-message-alerts-for-important-emails/
     
    #10 chanchan05, Dec 28, 2016
    Last edited: Dec 28, 2016
  11. lvt

    lvt Android Expert
    Rank:
     #97
    Points:
    283
    Posts:
    1,541
    Joined:
    Jan 30, 2013

    Jan 30, 2013
    1,541
    550
    283
    Male
    Paris <--> Taipei
    Please go to Settings / Power Manager / Battery Optimization/

    You will see the pull down menu with label Not optimized on the top left, pull it down and select All apps, click on the apps you don't want it to be affected by Doze and check Don't optimize.
     
  12. cdl

    cdl Android Enthusiast
    Thread Starter
    Rank:
     #558
    Points:
    43
    Posts:
    430
    Joined:
    Feb 4, 2010

    Feb 4, 2010
    430
    47
    43
    That's not the same thing as disabling doze. As said a million times, and as explained in detail in my other thread, the whitelisting is effectively useless because the exemption is only partial. Even whitelisting k9 mail, push via Imap idle won't work when the phone is in doze.
     
  13. chanchan05

    chanchan05 The Doctor
    Rank:
     #23
    Points:
    1,108
    Posts:
    14,813
    Joined:
    Jun 30, 2011

    Jun 30, 2011
    14,813
    4,536
    1,108
    Male
  14. lvt

    lvt Android Expert
    Rank:
     #97
    Points:
    283
    Posts:
    1,541
    Joined:
    Jan 30, 2013

    Jan 30, 2013
    1,541
    550
    283
    Male
    Paris <--> Taipei
    Is your Wi-Fi or Data working when your phone is in sleep mode?
     
  15. cdl

    cdl Android Enthusiast
    Thread Starter
    Rank:
     #558
    Points:
    43
    Posts:
    430
    Joined:
    Feb 4, 2010

    Feb 4, 2010
    430
    47
    43
    Thanks. However, it sounds inconvenient because, when the phone is not in doze, I'd be getting two notifications for each email, one on the app plus one via SMS.
    I had a look at some gateways for the UK and the service is too expensive for the volume of emails I receive.
     
  16. cdl

    cdl Android Enthusiast
    Thread Starter
    Rank:
     #558
    Points:
    43
    Posts:
    430
    Joined:
    Feb 4, 2010

    Feb 4, 2010
    430
    47
    43
    You mean in doze mode? Doze is different from ordinary sleep mode.
    In doze no, there is no data access in order to save battery. That's the whole point of doze.
     
  17. chanchan05

    chanchan05 The Doctor
    Rank:
     #23
    Points:
    1,108
    Posts:
    14,813
    Joined:
    Jun 30, 2011

    Jun 30, 2011
    14,813
    4,536
    1,108
    Male
    There's a free configuration that works for Gmail only. But then Gmail has a limit on how many SMS can be sent per day.

    On another note. I noted the part where you said you cannot set notification priority. However app settings (at least in the S7 Edge) has an option to toggle set notification as priority. Will that not alter behavior?
     
  18. cdl

    cdl Android Enthusiast
    Thread Starter
    Rank:
     #558
    Points:
    43
    Posts:
    430
    Joined:
    Feb 4, 2010

    Feb 4, 2010
    430
    47
    43
    No.
    One of the few things which wake a phone from doze is receiving a high-priority GCM notification. Think of it like the silent SMS sent by Blackberry servers, telling Blackberries they had to connect to retrieve new mail.

    For apps like k9 mail, which rely on Imap idle, nothing can be done as there are no GCM notifications at all.
    For the few email apps which rely on GCM, users cannot change the priority of the GCM notifications.

    I am not sure what notifications you are referring to but they are something else.
     
  19. chanchan05

    chanchan05 The Doctor
    Rank:
     #23
    Points:
    1,108
    Posts:
    14,813
    Joined:
    Jun 30, 2011

    Jun 30, 2011
    14,813
    4,536
    1,108
    Male
    Apps>Settings>Applications>Application Manager>Open app entry>notifications>one of the entries there is 'set as priority notifications'. Basically description is the notification goes to the top and is not affected by DND. I don't receive enough emails a day to test this if it works for Doze too.
     
  20. cdl

    cdl Android Enthusiast
    Thread Starter
    Rank:
     #558
    Points:
    43
    Posts:
    430
    Joined:
    Feb 4, 2010

    Feb 4, 2010
    430
    47
    43
    Like I said, that has nothing whatsoever to do with GCM notifications.
     
  21. cdl

    cdl Android Enthusiast
    Thread Starter
    Rank:
     #558
    Points:
    43
    Posts:
    430
    Joined:
    Feb 4, 2010

    Feb 4, 2010
    430
    47
    43
  22. overconscious

    overconscious Lurker
    Rank:
    None
    Points:
    15
    Posts:
    1
    Joined:
    May 21, 2017

    May 21, 2017
    1
    0
    15
    I have some idea:

    1. Temporarily root Your device.

    2. Create startup script with content like this:

    #!/system/bin/sh
    dumpsys deviceidle disable​

    You can adjust other deviceidle settings in the script, eg.: set idle_to and max_idle_to to one second or even zero (according to XDA it is required for Nougat to successfully deactivate doze).

    3. Write the script to /system/etc/init.d/ directory with name eg. 80disabledoze

    4. Change permissions of the file 80disabledoze to 755 (read and execute for all).

    5. Reboot Your phone

    6. Remove root from Your device.

    7. The script 80disabledoze should be run everytime Your phone boots and thus doze mode should be permanently disabled.
     
  23. mmhmmm

    mmhmmm Lurker
    Rank:
    None
    Points:
    15
    Posts:
    1
    Joined:
    May 22, 2017

    May 22, 2017
    1
    0
    15
    I'm in a similar boat as you, it sounds like - I need to be able to disable Doze to perform my job competently. I've read everything about Doze/Nougat I can get my hands on, including your various posts. I just purchased the Disable Doze app out of desperation and so far, no luck - it doesn't work for me and my Galazy S6 on Nougat.

    Thinking about other alternatives, the Doze requirements per the developers site says "screen off, stationary, battery." Have you happened upon anything that defines the exact requirements for "stationary?" I just tried 10 minutes (which is when my Doze kicks in) of literally moving the phone around by walking or swinging it around to activate the gyrometer and Doze still turned on. My only solution at this point might be to have it plugged in when I need notifications, which is ridiculous.
     
  24. FrantaFerda

    FrantaFerda Lurker
    Rank:
    None
    Points:
    5
    Posts:
    3
    Joined:
    Thursday

    Thursday
    3
    0
    5
    Is still anybody investigating into the problem? I have struggled with same issues as described in OP, and the deviceidle disable seems to disable the heavy dose mode, so my mail client and background services are again responsible (not tested thoroughly but after almost day I didn't meet an app lockout).

    I have additional questions on the light and deep sleep modes - while it's clear deepsleep breaks non-priority activities, is the light sleep affordable to keep active?

    Additionally I found two build.prop options being turned on

    pm.sleep_mode=1
    ro.ril.disable.power.collapse=0

    Both are serving to increase battery savings. Can I
    leave them active for reliable operation of background apps in the sleeptime?
     
  25. chanchan05

    chanchan05 The Doctor
    Rank:
     #23
    Points:
    1,108
    Posts:
    14,813
    Joined:
    Jun 30, 2011

    Jun 30, 2011
    14,813
    4,536
    1,108
    Male

    I started using push on the default email app on Samsung, and tested several times. Doze does not disable email pushing on that app.
     
    tube517 likes this.

Share This Page

Loading...