Hacker News new | past | comments | ask | show | jobs | submit login

That was true with Marshmallow.

With Nougat, no background tasks will be run at all while the screen is off – except for Google services, or if they keep the CPU on 100% of the time with a wake lock.

JobScheduler also doesn’t allow continuous tasks, but only short tasks – so you can’t actually keep a low-cost socket open.




> With Nougat, no background tasks will be run at all while the screen is off – except for Google services.

Untrue.

First, mobile Doze doesn't kick in immediately when the screen is off.

Second, mobile Doze apparently doesn't stop all background tasks except "Google services" from running, since "wake locks" from apps for background tasks are still supported.


Is that true? Will my email client stop notifying me of new email?

That doesn't sound appealing at all.


In most cases, notifications might be delayed by several hours, yes.

Or never happen at all.

Or just work normally.

Depending on when the heuristics think you are less likely to use your phone.

There is one way to keep getting notifications, by using proprietary Google services, and sending a ping from your server via Google to the device, or sending the actual notification that way.

Which, for email, means either everyone who does that has to build every app themselves from source, or you have to send that data to a third party server which then sends it to Google


> Is that true? Will my email client stop notifying me of new email?

There are mechanisms to get high-priority notifications, and methods to do background work that are batched on increasingly long intervals to save battery life (both the batching and the increasing intervals serve that purpose), so that shouldn't be an issue. Notifications that need to be immediate have a path, and ones that don't should still happen, just not immediately.


> Second, mobile Doze apparently doesn't stop all background tasks except "Google services" from running, since "wake locks" from apps for background tasks are still supported.

Except a Wake Lock has a significant battery impact, causing the CPU to stay on at all times.

There’s no way to keep your app running while also saving battery – which is the general ideal you want.

So, tell me, how do I keep a socket open without wasting battery?

    ________________________
A guarantee that, if the device has connection, the notification is transmitted within of 15 seconds, and that the device (in the case of the moto G 2014) gets still the 2 days battery runtime it’d get without the app.

That’s what I set as minimum goals for my app, and what I was able to get with older Android versions.


There's a pretty big difference between "no background tasks will be run except Google services" and "the options for background tasks are more restricted than in previous Android releases".

The second is indisputably true of Nougat, no one is arguing against it; the first is what you said upthread, what I was arguing against, and what is and remains false.


It is basically only Google, though, because the only way to keep something running is with a severe penalty, and the user is kept directly notified about that.

In previous dev versions, Google even didn’t allow wake locks at all (which is where my confusion is from), saying devs should instead move all their processing to server side, and use GCM for everything.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: