Hacker News new | ask | show | jobs
by ianlevesque 3589 days ago
This is the most significant update, way way overdue.
1 comments

Seriously. I switched back to an iPhone from Lollipop earlier this year, and the difference in battery life is staggering, even though the iPhone has a smaller battery than the Android phone I used to have.

I'm glad that Google has signaled that they are going to further tighten the restrictions on background app activities in future releases. I hope they follow through with it.

It's a trade-off. I hate that on iOS I have to have location services ON in order for, say, owncloud to back up my photos in the background. On Android, it just works in the background like it should. Sure, iOS saves on battery because of this, but I strongly feel I should have a say in this as a user. Some apps really should be allowed to run in the background.
Except everyone misuses such a thing, privacy gets violated, often don't test well for battery in many different conditions, and then users end up with a shit experience yet don't have the technical expertise to understand why (or which app is causing the problem). Android is particularly difficult since you can have a service running without an app present, so disabling it isn't very intuitive.

I think Apple has done a better job at this balance by not letting people shoot themselves in the foot at the cost the odd useful service not being possible.

Android's starting to head down this road in a better way - add more restrictions to prevent poorly written apps from draining your battery, but allow a override in settings to 'disable battery optimizations' for that app so the user still has control.
I have been on Android Beta on Nexus 6p and if I turn off the Now Cards, the phone takes 2 days to go from ~95% to ~45%. I do have to pay attention to how I keep the phone charged though... I always try to not charge beyond 95% and never let it drop below 40%.
I assume you can cite no evidence that your battery charging regimen makes any difference whatsoever.
Yea there's a bit of a disconnect between the two "things" stated in my comment. I guess what I was trying to say was that if I was not anal about hi and lo watermarks of the charge and didn't mind it dropping below 40%, and with Now Cards disabled... the phone could keep going between 3 to 4 days without charging.
I wonder if you could get the same effect by turning off only some of the Now cards. Perhaps a few of them are responsible for the majority of the battery usage.

It would be a shame to have to turn off all of them. I found most of them to be useful.

Didn't actually try to go into the details tbh. But that sounds like giving it a try though.
And with this, they just killed all actual apps for Android.

Anything you can do with an app you can do as well with a website.

Any actual app, not just a website in form of an app, which did computational task, data recording, or kept services available, is impossible to create now.

Run tracking app that doesn’t require you uploading your GPS data to Google Fit? Impossible.

Messaging app that doesn’t route all your private messages through Google Cloud Messaging? Impossible.

EDIT: before downvoting, read the comment below from morsch, he and I explained there pretty well the issues.

What on earth are you talking about? All of those things you listed as impossible will still be possible.

All Google did is restrict what apps can do in the background, and announced that there will be further restrictions in the future: all background tasks will have to be done through the JobScheduler API.

This does not prevent apps from doing stuff in the background, it just prevents them from doing whatever they want, whenever they want -- they will have to follow the proper procedure.

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.

> 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.

This is basically what iOS has done from the start.

If you don't see the app in front of you, iOS will very quickly kill it if it has any background tasks.

It's a leaky abstraction, but honestly I like the implicit promise/guarantee between the scheduler and the user.

I only get annoyed when I want some batch task like uploading photos, but even then it's not too hard to leave the phone powered on and unlocked on my desk until the photos upload...

Except when you try to ensure someone gets notifications while the phone is in an intranet.

Or when you try to transmit notifications without going through Google/Apple servers, because those require you to control the messaging server (due to API auth limitations), which does not work with distributed systems.

A messaging app that only works when the screen is on is useless.

Why not use Apple's servers to deliver a ping, and then the app checks with your own server what the content of the message should be?

That way, you get realtime event notifications without the privacy risk of exposing content to Apple's servers.

To send any message to Apple’s push service, you need to have a certificate.

That same certificate can be used to replace your app on the store, or so on.

Basically, that is your one key to the kingdom.

So, I obviously can’t give everyone who hosts a server for the app that key.

So I have to host a server transmitting all those pings then.

Even ignoring the obvious DDoS risk, and assuming it’s only used in good ways, I end up with having to buy an entire additional server, just for that.

And I still leak metadata, which – as the NSA has shown – can be easily correlated with who is whom if you have enough data.

Please provide a link to this if you can.
Here's something he's referring to; messaging through Google's cloud infrastructure may be privileged[0]: "Like in Marshmallow, apps can still "punch through" Doze mode by sending a "high-priority message" via Firebase Cloud Messaging (formerly called "Google Cloud Messaging"). High-priority messages are the expected format for instant messaging apps, so users still get notified of messages when their phone is Dozing."

Hard to say whether this is one way to do it, or the only way. (E.g. "Unlike stationary Doze, wake locks (apps requesting the phone stay awake so they can do background tasks) are still allowed.")

[0] http://arstechnica.com/gadgets/2016/08/android-7-0-nougat-re...

Thanks, that’s part of what I was referring to.

A wake lock is possible, but it’s far more battery intensive than just using the pre-Nougat solutions.

Pre-Nougat, I could keep a socket open, and only have a timeout message sent every 28 minutes to keep it open – at very low battery cost.

Now I either have to keep a wakelock – keeping the CPU always on, instead of just a few milliseconds per hour – or I can’t use it at all.

That’s a severe issue for me.

(I can’t use GCM, due to architectural reasons, and would have to ask tenthousands of people to change their IRC bouncer setup completely).