Hacker News new | ask | show | jobs
by kuschku 3593 days ago
> 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.

1 comments

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.