
Android vendors, don’t kill my app - kumaranvpl
https://dontkillmyapp.com/
======
adrianhon
For our Zombies, Run! run tracking/audio adventure app, "battery management"
is turning into our most consistent customer complaint, to the point where
it's impacting review scores, active users, and probably subscriptions. The
result of the changes made by Huawei, OnePlus, Xiaomi, and Samsung mean that
our app is killed during runs, and people interpret that as the app crashing.

We're trying to figure out the best way of telling users how to change their
battery settings (which, for the avoidance of doubt, are usually on by
default; and sometimes _revert back to default_ on OS updates); some kind of
annoying modal popup in the app before they begin a run, perhaps.

What can I say? These Android manufacturers are prioritising numbers they can
put on a spec sheet over the end-user experience on entire categories of
legitimate fitness and audio apps. We have no recourse and no way to get on
their whitelist. Maybe Google could threaten the manufacturers, but that would
be a nuclear-level response.

Yet another thing third-party app developers have to deal with.

~~~
Ninn
Would it be possible to detect that the app was killed while engaged in such a
situration as yours, i.e. similar how to systemd detects killed apps with a
keepalive ping written to the fs while engaged.

Then on the next boot explain that you detected this, and guide the user to
OP's page? Or is it way more complicated than so?

~~~
shimfish
Whether this is possible or not is deeply missing the point as well as showing
a vital misunderstanding about UX.

~~~
shimfish
People were correct to downvote my comment. The tone was all wrong. For some
reason, I take Android's many shortcomings as a personal affront. I guess
that's what years of being a dev where all the piracy and user support are
with Android issues while only returning a fraction of the profit compared to
iOS will do to you.

The point is that this is entirely Google's fault and yet it's the devs who
have to clear up the mess and take the blame, or alternatively we bombard the
users with technical fixes and explanations. Quite clearly neither of these
options is where we should be with a mature OS on a mass consumer device.

Now I'm getting all angry again just thinking about it. Time to up my meds.

------
sudhirj
This is the Android multitasking lead finally coming fully circle. Android had
multi tasking much earlier and in a more powerful way by allowing apps to
start their own serivices and do pretty much whatever they wanted, but this is
the unfortunate logical result - apps that agressively kill other apps,
installed by the handset manufacturers, to protect users from badly written
apps that drain the battery in the services.

Apple took a lot of flak for not having multitasking, but to they credit they
took the time to build explicit APIs that allowed apps to handoff certain
whitelisted tasks (audio playback, downloads, alarms, notifications) to the
OS, and made clear guarantees about the circumstances under which the APIs
would work.

~~~
simias
Isn't it also the consequence of taking the control away from the user? Why
can't I whitelist which applications I want to allow to run in the background?
Why do I still have to grant an application all the permissions it requests
when I install it instead of being able to turn them on or off individually?

By dumbing things down that way Google created this situation IMO, it's bad
from a quality, usability and privacy perspective. Of course Google considers
that you leaking your personal info is a feature so that part probably won't
change, but they should at least care about the two other points.

~~~
sudhirj
And yeah, the permissions model in Android vs Apple is different, but multi
tasking in particular feels the same. i.e. Apple has fine grained permissions
on demand for contacts, microphone, camera, location, etc, and requires that
all apps gracefully degrade when permissions is denied.

But for multitasking there isn’t really any fine grained permissions - as long
as the app is doing a whitelisted task in the background, no user permission
is required. I think Apple does check that background APIs are not misused as
part of the review process, though - I don’t think you could implement a
tracking socket masquerading as a background download, for instace.

~~~
simonh
As I understand it, on iOS third part apps don’t actually do any tasks in the
background, most such services are actually implemented by platform services
provided by Apple that the third part apps request or subscribe to. So for
example apps request an Apple service to do a background download on their
behalf. Or the app subscribes to a notification feed that wakes it up when
triggered to handle the notification, but the app doesn't do a download or
wait for notifications itself.

Very often on iOS when you see a notification 'from an app' or something in
the background is completed 'by an app', in fact the app didn't do any of it.
This means fine grained permissions for background processing aren't really an
issue on iOS, because such behavior is managed and guaranteed by Apple. It
only matters when there's a security or privacy implication.

This is why background activities came so much later to iOS, because Apple had
to very carefully think through and implement all the background services apps
would require in an efficient and secure way.

EDIT: To be clear there are some exceptions but I'm not sure exactly what they
are.

~~~
tinus_hn
For some basic use cases, like notifications and downloads, there is a special
system or api that allows your app to do that in the background without
actually running.

If you want to play audio or track gps in the background you need to do things
yourself though.

~~~
simonh
OK, hence the Facebook issue where they played a silent audio track to keep
their app active. I'd forgotten about that, thanks.

~~~
vxNsr
Wow, that sucks is again super user hostile, I'm so happy I removed their app.

------
whouweling
We are running a (very niche) platform + app for people with special needs,
where accurate and offline alarms are necessary: this is a big problem for us.

I think about 1/3 of all our support requests are about the app being killed
in the background on specific phones. The part of the app that does the actual
scheduling of the alarms is a big mess with lots of device & API level
exceptions. Debugging alarm problems is a nightmare.

We often advice users on what phone to buy and tell them to avoid specific
brands. Sometimes users even need to buy a new phone to be able to have
reliable alarm signals.

I understand why manufactures are doing this. But it really degrades the user
experiences for our users quite a bit and is a significant cost (in terms of
support load + extra development) for us as an app vendor.

Really hope that Android 8+ incentive manufactures to just use the standard
Android mechanisms: they seems to work quite well in my experience. You can
run things in the background, but only if it has a user interaction as a
result: i.e an alarm notification. The user can then determine if this is
wanted or not directly from the notification itself.

Unfortunately it is not much better on the Apple side of things with local
push notifications limits.

~~~
scarface74
Does Android not have the concept of “local notifications” where you can tell
the OS to schedule a notification to be sent to the app to wake it up instead
of being in the background the whole time?

~~~
richardwhiuk
It does - the one that works properly is
[https://developer.android.com/reference/android/app/AlarmMan...](https://developer.android.com/reference/android/app/AlarmManager#setExactAndAllowWhileIdle\(int,%20long,%20android.app.PendingIntent\))

However, the implementations of the API are questionable.

Some calls to that API on some OEMs device round alarms to the nearest minute,
some to the nearest ten minutes.

~~~
colejohnson66
> Some calls to that API on some OEMs device round alarms to the nearest
> minute, some to the nearest ten minutes.

WHY? What benefit does that serve?

~~~
apexalpha
>WHY?

Because China.

Having lived in China for a few months with an Android phone I can with
absolute certainty tell you that this is needed over there. The amount of
garbage apps, even from big companies like baidu is enourmous!

And without a Google playstore, or play services, or play safety thing it is
an absolute wild-west of background alarms, API calls, battery draining and
whatnot.

~~~
mfoy_
Sorry, how does rounding to the nearest minute or nearest TEN minutes solve
any problems?

Like are apps setting alarms for every 3 seconds or something for no reason??

~~~
apexalpha
Yes. Rounding to 10 min means you fire up the cpu and do all apps at once then
go idle.

~~~
mfoy_
Oh, so when we say "alarms" we mean "background processes that occur at set
intervals"?

Not literally "alarms", like the ones that ring?

~~~
richardwhiuk
Both.

------
traspler
For me this problem is very real. For example I got my mother a Pocofone F1
(by Xiaomi). Everything works fine, WhatsApp notifications arrive but there
are some apps which just get crushed by Xiaomi's battery saver.

Audible's lock-screen widget for example just does not show up unless you
enable/disable 2-3 battery saving and notification settings after installing
the app. I think this incantation can't be expected even from advanced users.
Normal users will just give up and live with terrible UX, complain to the dev
or switch to another app. The same goes for fitbit, getting it to sync in the
background involves a similar mixture of battery saving and notification
settings which are labeled in a way that noone would dare to change them or
have questionable defaults. None of this was an issue on the Nexus 5X. To me
it looks like Xiaomi has a whitelist of apps which get special defaults when
installing so they work fine while others which are not on this whitelist
don't get this treatment.

I can understand the benefits of aggressive battery saving especially as there
are apps which behave badly but the state it has come to now is terrible UX
and is just another frustration instead if actually delivering a benefit to
the user. This seems to me like "optimisation" for the sake of benchmarks and
marketing claims.

~~~
simonh
If they didn't do this sort of aggressive system management, I'm wondering
what the negative effects would be for them as a brand. I doubt it would be
about benchmarks, those are generally done on clean systems at least for
review purposes. Likewise Marketing is mainly about features.

I suppose it must be genuinely about the user experience and brand perception
by device owners. If the phone slows down and the battery drains fast users
will blame the phone manufacturer, while if apps crash or app features don't
work users will blame the app vendor even though the reality in both cases
would be the other way around.

------
yason
Killing apps is a _good thing_. There have been battery saver programs since
the very beginning of early Android versions to kill of connectivity and clean
up running apps. When Android now supports some of that natively and vendors
too, even more aggressively, this is just responding to users' needs.

There is a quite clear usage pattern to support this behaviour: unless I
explicitly say so, I don't want apps on their own to "do stuff" no more than I
want my Ubuntu to "do stuff" while I'm doing something else. I only want the
application to respond when I'm viewing it.

On Ubuntu, I always disable stuff like evolution server and automatic indexing
after a fresh installation. At least you can do that on Ubuntu, that isn't
necessarily always possible on locked-down systems. I'm happy that Android is
quite usable these days because of Doze and background task killing.

~~~
gambiting
I mean sure, but at least give me a way to override it. On my OnePlus 5T
running Android Pie, the system will keep killing my VPN client when in sleep
mode, even though I have selected that I don't want to optimize it under
battery usage. With the VPN client restricting all unprotected access, it
means that once the phone goes into sleep, I stop getting all notifications
for anything because there is no internet connection. It's very frustrating.

~~~
Abishek_Muthian
Try selecting 'Lock' for the VPN App from the recent apps section (top
right)[1]

[1]:[https://imgur.com/Bk8jXbJ](https://imgur.com/Bk8jXbJ)

~~~
gambiting
Hmmm, I had no idea this was a thing. Will give it a try!

------
xupybd
I actually like the move to kill background tasks. Don't get me wrong I think
they're great when they're needed. But if I only installed the app because the
mobile site is crippled I don't want it to destroy my battery polling for
content changes when I only open the app once in a blue moon.

~~~
me551ah
Killing background tasks is great and Android does that automatically to save
battery usage. But these manufacturers have implemented their own
functionality on top of Android which cripples even critical messaging
applications like WhatsApp, Slack, Gmail by not delivering Instant Messages
notifications instantly.

~~~
daveFNbuck
I don't want Slack or Gmail to deliver notifications instantly. I'd love to
have functionality that saves battery by delaying them.

~~~
scarejunba
Both these apps allow you to do that in-app. I have Gmail not notify me for
work emails and notify me for stuff on my personal account.

~~~
daveFNbuck
I want all the notifications. This was a question about timing. I don't want
them to do the constant polling required for the notifications to appear
instantly.

------
xyzal
To be honest, as a user I really like the implementation of battery saving
features of my Sony phone:

1\. They are not enabled by default

2\. Their settings screen explicitly states what the modes do

3\. They can extend battery life significantly

The most aggressive mode is called Ultra Stamina, and it works by basically
turning the phone into dumbphone mode -- complete without any internet
connectivity, calls, SMS and alarm clock only -- and the phone has no problem
lasting a week.

I use these modes extensively when going backpacking for several days, as I do
not have to carry any power banks, which saves precious gramms :)

edit: punctuation, grammar

~~~
z3t4
Interesting. Batteries in smartphones usually have five times more battery
capacity then feature phones, it should last over a month!

~~~
kda26
Smartphones also have 5x more screen to light up, too.

~~~
AstralStorm
Reminds me of YotaPhone 2 eInk display - pretty crummy, but the Snapdragon 820
device stayed on a week on without additional power saving...

------
me551ah
Interestingly though it is possible to remotely detect which users are facing
this problem and send them instructions on how to add an app to the device's
whitelist. I faced this exact problem in my previous company Flock, and built
services to detect and inform users which substantially brought down user
complaints.

[https://hackernoon.com/notifications-in-android-are-
horribly...](https://hackernoon.com/notifications-in-android-are-horribly-
broken-b8dbec63f48a)

~~~
GeneralTspoon
Nice write-up, and interesting idea.

But how did you guys deal with the situation where FCM delivers and displays a
notification without waking your app up. In that case, if the user dismisses
the notification without opening it, then it will count as delivered by FCM,
but not as delivered by your app, right? Which isn’t actually the case.

~~~
me551ah
What we observed was that in cases of devices like xiaomi and oneplus, the app
goes into a state of being force killed. So even if the notification sent is
one without a data payload ( in which case the app is not woken up ) , the
notification will not be displayed to the user. To get around this issue we
sent all messages with a data payload to ensure that the app is woken up(or
atleast the system tries to wake it up).

------
sergiosgc
I have an Android One Nokia (8 Sirocco), and:

a) I wholeheartedly want this behaviour. The phone lasts 2-3 days without
recharging, and I no longer fear leaving home with 30% battery.

b) It's not an app that kills background apps. It's Android's own Background
Activity Manager, where apps that are not whitelisted can't wake up the CPU.
They run only when the CPU wakes up for some other reason (screen-on qualifies
but it's not the only opportunity).

I had to get used to it. In one instance the alarm didn't wake me up, because
it is not whitelisted to wake up the CPU. After enabling the correct apps, I
maintain pretty much the same great battery life and all app functionality I
want.

~~~
TruthSHIFT
From a usability perspective, this sounds crazy. Is is responsible of me to
recommend Android to my non-technical friends?

~~~
apexalpha
I wouldn't say so. I got my grandma a cheap Android phone and a book to help
her learn because I thought it'd be better since I also have Android and can
help her.

My grandma is 89 now, she uses Whatsapp, Youtube and whatnot and I am not
kidding but within 2 months she had:

\- AVG antivirus (an ad told her she had a virus)

\- She had batterylife for 7 hours before a charge was needed due to shitty
apps

\- Ads on her lock screen?!

\- Ads on her homepage

After 6 months and 3 house calls to fix her phone we gave up and she got my
aunts old iPhone 5s with a new battery.

It runs iOS 12 now and it runs flawlessly and protects her from all the stuff
I mentioned.

From a guy that has always had Android: most users need iOS level protection.
Just simple facts.

~~~
Andrex
A cheap phone has worse functionality than an expensive* one? Forgive the
snark but this comparison doesn't make sense to me.

*Speaking in terms of launch MSRP.

~~~
apexalpha
The software was stock android (Android One project).

The important part was that the 4 year old iPhone 5s had the latest iOS and
still works better than a new €250 Android.

------
perlgeek
[https://dontkillmyapp.com/samsung](https://dontkillmyapp.com/samsung)

> Yes, even Samsung - a dominant vendor in the Android market - is using nasty
> battery saving technique which may kill background processes and render
> alarm clocks useless. See below for workarounds.

Wait, do you really need a background task for alarms?

(why) isn't there a system-level service to notify and wake up your app at a
pre-defined time or interval?

~~~
seszett
No, you don't need a background task for alarms. There is a JobScheduler API
for that.

The aggressive battery settings of most vendors only interfere with badly
coded apps to begin with, apps that use background tasks when they should be
using more appropriate APIs.

~~~
CannisterFlux
On some Xiaomi devices the stock alarm clock - the Google one - regularly
fails to trigger alarms. If Google themselves cannot code an Android alarm
clock that works with these aggressive battery saving anti-features there's
little hope for anyone else.

~~~
hiddentruth
Are you referring to Xiaomi devices that are running stock android (part of
Android One program)?

~~~
CannisterFlux
No, I have an A1 and it doesn't have these problems. Note 5 definitely did the
random alarm fail thing. The Note 5 kills other apps too like step counter or
calendar event notifications. Maybe those apps are "badly coded" or whatever,
but on a Moto G that sort of shenanigans didn't happen and the same apps
worked great with no terrible battery life.

------
kijin
The default mail app on my recent-ish Samsung flagship phone notifies me of
new email anywhere from 30 minutes to 1 hour late. I used to depend on K9 Mail
for business on the go, but it was even worse: notifications were often
several hours late. Android was dropping the IMAP connection and not allowing
the app to reconnect for a routine poll.

There doesn't seem to be any general-purpose email app on Android that can
actually notify me at a reasonable interval (less than 10 minutes, if not
immediately). Even after disabling every power-saving feature I could find,
Samsung is still killing and crippling their own default app.

I understand that it takes a bit of battery to poll an IMAP server every few
minutes. But if I want an app to be able to poll an IMAP server in the
background at the cost of having to charge my phone a little more often,
that's my choice. Besides, my old phone didn't have this problem and its
battery still lasted a whole day.

What's even more infuriating is that the phone allows preinstalled social
networking apps that I don't even use to continue running in the background
while it happily kills the apps I actually need.

~~~
londons_explore
The social media apps will almost certainly use Googles push notification
service, which is the only background notification allowed.

Your imap client is trying to hold a TCP connection open to your server, which
isn't allowed.

There's a good reason the phone doesn't allow that. Firstly, the push
notification service can be waiting for a notification for an app while the
app is entirely unloaded from RAM. Hundreds of apps can be listening for
notifications at once, with no system resource overhead.

Secondly, imagine every app wanted to have a TCP connection open to it's own
server. TCP must generally go through your wifi/3g providers NAT. That NAT
gateway will drop idle connections, with the rules on which connections are
dropped varying for every type of router and provider. In general, if you want
reliable delivery, you're going to have to send some packet down a TCP
connection every 5 minutes, although some providers it can be up to every 3
hours. If every app applies it's own heuristics to figure out how often to
send a keep-alive message, and you have hundreds of listening apps each with
their own connection, and no synchronisation between them, your phone will end
up waking up every few seconds for some app to send a keep-alive.

Instead, Google keeps open just one connection. They have a serverside
database of all network providers to know which ones drop connections when
(BTW, this is a big advantage of using your cable providers default modem. If
you have your own modem, this mechanism won't be accurate). It can then wake
up and send just one keep-alive at the exact correct time.

From the server side, Google can batch messages to clients. It can decide that
receiving 8 new marketing emails is important enough to sync to your phone,
but only if the phone will be waking up for some other reason. Then when a
snapchat message comes in, both the mail app and snapchat will be notified by
a single wakeup of the phone.

Overall, it's a very good design. There are only 2 big downsides:

1) It's centralized. Nobody else can run a notification server. They have a
monopoly on delivering notifications.

2) Their server isn't very good. It doesn't have the capability for example to
simultaneously listen on 3G and wifi. It sometimes gets overloaded and
unnecessarily delays messages. Their database of network providers is
sometimes a bit off, meaning your phone is sending keep-alives every 30
minutes, while the connection times out after 20 minutes, meaning there is a
33% chance your message will get delayed by up to 10 mins.

~~~
amaccuish
Do you know of anywhere, where this is all explained? Like the idea of
recording average timeouts by ISP?

~~~
londons_explore
I'm not sure anyones written it up yet. You can see it for yourself if you run
adb logcat on a sleeping phone. Try running it on different networks and see
the keep alive period. (you'll have to turn off all push notification sources,
because a push message counts as a keep alive too).

------
fixermark
Counterpoint:

Battery life consumption rarely comes up as a feature bullet-point for an app
writer, because visibility on whether a given app is a battery hog is low
(both for developers and users). There are a couple of reasons iOS was so
draconian about background processes for most of its history, and this was one
of them. This ecosystem shift puts pressure back on developers to get creative
and ask hard questions about how much energy they really need to consume for
their tasks.

One issue is that these first furtive steps in that direction may not be
putting the tools in the developers' hands to do that well. But everything in
software starts at an early phase.

(It'll be interesting to see whether the market prioritizes battery life by
getting the phones implementing these features or app richness by treating
these phones as "damaged" and routing around them. This site certainly helps
customers make that choice).

~~~
zmmmmm
I agree. What's really broken is lack of a good feedback loop both to app
developers and the OS vendors. It would be good if this translated to two
things:

\- google mandates that killing background apps must be based on actual
battery consumption

\- when an app that requested background permissions is background-killed,
this is reported to the app developer and OS vendor in some sort of aggregate
metrics they can see

\- users should get some kind of report or notification as well about it

You would instantly see both OS vendors and app developers trying to optimise
the battery life of their apps so that they can stay alive.

Ideally, users who want to should be able to actually set thresholds on how
much battery any app can consume. Eg: if I am OK that my phone only lasts an
hour I should be allowed to tell it to keep my minecraft server on on the
background so everyone can keep playing.

------
TeMPOraL
Here's a process management UX I've been asking for ever since Android came
out:

I want to have a list of _all_ running apps and their background services. I
want to be able to put any app/service from this list down, _and have it stay
down_. That is, I want the ability to kill an app and/or their services, and
not see them again until next reboot or the next time I launch the app in
question.

It's not _that_ big of an UX burden, and it would solve a lot of the battery
management issues.

------
fsfsdff56sdf
Not sure if the complaint here is simply from developers of badly designed
apps?

I didn't do much Android development, but last year I had to develop a small
app doing a continuous background task.

Yes, it is hard to do that in Android (it seems). But you are supposed to use
all sorts of other mechanisms that Android provides. Like for an alarm clock,
I guess you tell some system service to play the sound and then go back to
sleep. The sound keeps playing and your app sleeps (I guess - don't know this
particular case).

Some things seemed really hard to do, but it is by design, and users really
need to be protected from vampiric apps.

------
maxmunzel
I don’t see their problem with Sony’s stamina mode:

The UI makes it very clear if you have it enabled, it explicitly tells you
what it does and I never missed anything because of it.

If you keep your phone on silent you don’t care if it delays fetching messages
until you actually turn on your screen anyway...

~~~
zapzupnz
> If you keep your phone on silent you don't care if it delays fetching
> messages until you actually turn on your screen anyway...

That doesn't follow. All I want is my phone to be quiet; I don't stop caring
about timely notifications because of this. Also, just because my phone is on
silent doesn't mean vibration is turned off and, in the case of my iPhone, the
notifications go to my Apple Watch.

------
hiddentruth
I am glad that they are doing it. Also, I don't think this is being done for
benchmarks or marketing. Pretty much all mobile manufacturers specify/market
the battery capacity in mAh and not in terms of hours. Also, even in cases
where the battery life is marketed as full day/2 day, I don't think it impacts
the purchase decisions. Killing background apps has annoyed me sometimes, but
there have always been solutions by tweaking the settings, in my experience
(on Nokia, Xiaomi & Samsung). Overall, it has definitely improved my
experience by drastically improving battery life. The article says "just to
get a little more juice", which I have found to be untrue in my experience.
For example, comparing the battery life of Xiaomi Redmi Note 3 running MIUI vs
the same hardware running Lineage OS, the battery life was significantly
better on MIUI and worth the sacrifice of spending some additional time in
setting up apps for background execution. I wish my current Nokia phone was
more aggressive in killing tasks.

------
RangerScience
I'm confused. Is this something that occurs all the time, or only when I turn
on Battery Saver? Because I _love_ Battery Saver mode. Unless you're a
communications app (messaging, phone, email) I don't need your app running
when I'm not actively using it.

~~~
londons_explore
Most brands of phone do this all the time, and do it even more aggressively in
battery saver mode.

------
kkkaizer
I dont get it?

This is the best thing for me. Iam fed up of the notification loop of apps
that I have to eventually delete.

Thank god for telling me to buy a Nokia next time.

~~~
detaro
(assuming the claims on the site are correct, since I have no first-hand data
on it) You really don't get that some people think apps like alarm clocks,
sleep tracking, GPS logging, ... are useful and should be allowed to run if
the user chooses them? _To me_ , a phone that can't reliably run an
application for a few hours is fairly useless.

~~~
r3bl
I own a Nokia phone running Pie.

My alarms go off just fine (although I vaguely remember it not going off once
or twice a few updates ago), my activity tracker works fine[0] and syncs
periodically. I don't use GPS constantly. Signal notifications were also
delayed a few updates ago, but now everything runs smoothly.

I find it a worthy sacrifice to make for a sturdy Android One phone with solid
performance and a battery that can last two days on medium usage. My activity
tracker lasts weeks without charging (comparable to a Kindle).

[0] Worth pointing out that my activity tracker was also developed by Nokia
(before they've sold their health division to Withings), so it may receive
some special treatment.

~~~
sorenjan
I read a comment on Reddit [0] from a Nokia user that had a large file
transfer using Solid Explorer killed twice because he left the phone
unattended and the screen shut off. It worked when he kept the screen on.

Would you mind testing if background file transfers work as standard and with
manual battery optimization whitelisting?

[0]
[https://www.reddit.com/r/Nokia/comments/afkuh4/dontkillmyapp...](https://www.reddit.com/r/Nokia/comments/afkuh4/dontkillmyappcom_shames_hmd_because_of_needlessly/edzr6ar/)

------
eps
The site lacks proper technical explanation of what the problem is exactly.

~~~
kawsper
This sheds a bit more light on it, whilst still being non-technical:
[https://dontkillmyapp.com/problem/](https://dontkillmyapp.com/problem/)

It seems to be that these vendors ship builds of Android with aggressive
battery-optimized defaults that breaks applications that rely on being able to
run in the background.

~~~
dbrgn
Not just long-running background processes (e.g. gemerating a backup of your
app). It may even prevent your push notification handler from running.

~~~
barrkel
Most push notifications are spam, and even when they aren't, they are usually
from self-important apps that think they are the most important thing running
on your phone.

The only push notifications I want are messages from humans.

~~~
dbrgn
See - messengers use push notifications to let you know about messages from
humans. Most users of messengers get (understandably) upset if they don't
receive notifications for incoming messages.

Note that you can always block notifications for apps you chose. The problem
here is the other way around: You _do_ want notifications, but even though you
disable battery optimizations and some other things for the app you're using
you can't get push notifications to be delivered reliably. That's a pain.

------
EamonnMR
I actually really like the battery optimization feature. I've only needed to
turn off battery optimization for one app: Slack, because I need alerts for it
at all hours. Every other app manages to get it's alerts through without it
and the battery on my OnePlus 6 lasts forever. Sorry app developers but if I
have to trade performance for battery in background apps, I'm going to choose
battery almost every time.

------
yccheok
I think Google should consider addressing this issue in their next Android.

If you browse through Alarm Clock app in Google Play Store, you will realize
most them are having similar customer complain - "The app used to work till I
upgrade Android OS"

Currently, I need to post the text in my Google Play Store description :-

" Reminder doesn't work reliably for certain devices. Their over aggressive
Battery management mode, have prevent reminder to work in background. Please
turn off that "feature", allow WeNote runs in background, if you want reminder
to work reliably.

Please read [https://dontkillmyapp.com/?3](https://dontkillmyapp.com/?3) for
solution. "

------
mosselman
First I though "Is Nokia bad or good? Then I saw 'bad vendor score'" so I
figured they are the worst. Then I got confused about all the vendors having
the same score, but a different colour. Then I saw that some of the circles
are slightly darker than the others... This type of visual communication hurts
my brain too much.

~~~
kalleboo
Something on your end is not loading (JavaScript off?)

Each vendor has 1-5 poop emojis with Nokia having 5 and Stock Android only 1

~~~
mosselman
Thanks, yep, I ad-block external domains by default.

------
_pmf_
I watch the evolution (and evolution is the right word here, given the
complete lack of intelligent design) of Android APIs with a kind of morbid
fascination; a ritual dance between inept API designers with the foresight of
a two year old spotting an ice cream vendor across a busy street and app
developers who (driven by management) have to buy into the fact that their
life saving and community transforming app (CRUD app for ordering fast food or
something like that) must support 34 kinds of real time notifications.

------
chrisreed212
Interesting - I recently got myself an S9 and my wife a OnePlus 6T, and the
OnePlus gets much better battery life (with fewer apps and overall lighter
usage) - but now I'm not so impressed if that's how it's achieved.

It's a fairly divisive issue - I can understand developers getting frustrated
if their app's functionality is broken, but I do think this should be more in
the user's control. A permissions-based model for backgrounding would be
better, but there's too much permission prompting as well on Android (and this
is something you can't back up - so on any restore, you're left 'allowing'
permissions in every app you use in a new way - yes, when I select the camera
mode in an app, I want to allow use of the camera - gets tedious across a
bunch of different apps).

My S9 (or maybe it's just Android) also puts a notification up if an app
continues to run when I click 'back' out of it (or some other heuristic - it's
not for every app, but it does a good job of identifying which are running) -
which I think is a better compromise. It makes it much more visible which apps
are consuming resources, and tapping the notification takes me to the App Info
page with the 'Force Stop' button at the top. It's a bit noisy (it appears
even for the stock music player, where obviously I want that to continue
running), but it serves well as forcing visibility of battery hogs (whether
it's through incompetence or nefarious background data collection), and
reassuring to see it there for the apps I want running in the background. I
would rather see more of this sort of visibility - maybe as well as just
overall battery usage, the battery use in settings should show battery usage
by apps when the screen is off or the app is not in the foreground. As the
device owner, I want to be in charge of which apps get that privilege.

------
ericflo
An example of this problem is casting shows to Chromecast. Android often kills
your app in the background while you're watching, and now your Chromecast
controls don't work and you have to reconnect.

~~~
kadal
This is so annoying! Do you know what needs to be whitelisted?

~~~
ericflo
I haven't been able to really figure it out, to be honest.

------
erikrothoff
Such a relief to find this! Some of our users use our Android app for very
time sensitive notifications. They constantly come to us saying that our apps
and push notifications are slow. It always seems to come back to battery
saving modes for their specific Android device, and a quick Google and
following the top steps never seem to work. This is so very helpful!

------
Yizahi
On the other hand there is an uncontrollable mess of bad apps made even by
reputable vendors such as Samsung that just sometimes enter whatever weird
state that is impossible to debug and just drain battery like there is no
tomorrow. More advanced power drainers don't drain battery themselves but hide
in shadows and just keep the phone in "awake" state, essentially halving it's
battery life and are very hard to catch and impossible to fix (except for
uninstall). I'm both hands for ultra aggressive battery saving modes because
if one or even ten apps malfunction it not good but acceptable, if in the
evening of day 1 I have 5-10% of battery on the phone that is verifiable
capable of running for 2 days, now this is unacceptable. It it renders Skype
on mobile unusable, because it is always killed by battery saver, well to hell
with such crappy app, their competitors work just fine in the same
environment.

------
dreamcompiler
If they'd just abandon the quest for thinness and put decently-large removable
batteries in their phones, it would make crap like this unnessary.

------
londons_explore
The solution to this should be _user experience billing_.

If your app wants to run a background service which degrades the users
battery, you are _degrading the user experience for that user, and all the
other apps they use_.

Another app on the same phone which is very power efficient will still not get
used if the battery is dead!

App developers who use up the phone battery should be required to compensate
those who use it sparingly.

Google could set up a market for 'milliamp-hours', where each mAh used up by
an app is worth $0.00001c. Apps will put money in the pot (subtracted from ad
revenue) proportional to how much power they use, and be handed out to all
apps based on app usage (how many hours in the foreground for example).

~~~
jmiserez
Ehm, no?! I want _more_ control over what runs not less. It's my electricity
on my phone, I certainly don't need someone else auctioning it off like my
phone is a billboard.

Your idea basically means that apps that spam ads can use more power, even if
they're used less. And free or paid apps without ads couldn't afford to run at
all. How does this help the user?

------
epaga
I have had SO many problems with my Android version of a background-running
app I made. I've even made a PDF guide just like this page for my customers.
Glad to see it's "not just me" \- hopefully the vendors will start waking up.

------
salex89
Only issue I have on my OnePlus 3T is Slack. I'm constantly missing or getting
late notifications. And I tried fixing the issues with their support, but it
didn't lead anywhere. They tried their best, but I can't blame the phone
vendor because I have a dozen more apps with notifications, services and
whatnot running quite well.

I've been out of Android app development for some time, but I hang out with a
few Android developers, they usually have most of the issues with Samsung,
they say that there are often some quirks that have to overcome. That mostly
corresponds to my outdated experience.

~~~
tuukkah
Whether it's an Android issue or specific to OnePlus, I've noticed I have to
reconfigure Slack as a "non-battery-optimised" app after each app update.

EDIT: More info on the subpage: "To avoid the system to automatically revert
the not optimized setting, you must also lock the app into the ‘Recent App’
list." [https://dontkillmyapp.com/oneplus](https://dontkillmyapp.com/oneplus)

------
spalt
"Doze" is a nightmare for apps that need reliable GPS readings.. the only real
solution is a service that polls continually to get the GPS when the screen is
_on_ so that when the screen is _off_ it can use it to do various background
tasks (and of course, it ends up not being super accurate as when the screen
is off the user is typically moving, which is when you'd want the GPS to be
accurate). This ends up using more energy than would have been saved if the
GPS wasn't available periodically when the screen is off! It's totally
ridiculous..

------
ac130kz
Badly written apps make 99% of Google Play, no wonder vendors are trying to
resolve it.

------
edoo
I only looked at Nokia but it shows an embarrassing solution to the problem of
users not having enough control over their phones. It should be effortless for
users to control what apps can run and how much power they can use in the
background.

It is time for the vendor neutral cell sized tablet with only a data module to
avoid the draconian telecom monopoly protection regulations.

------
npunt
See also this post about notifications delivery interruptions on Android and
how to fix it: [https://onesignal.com/blog/manufacturers-interfere-with-
reli...](https://onesignal.com/blog/manufacturers-interfere-with-reliable-
notifications/)

------
zaro
I think the approach taken by these phone manufacturers a tually makes a lot
of sense.

Most developers won't admit it but a lot of apps are quite terrible nowadays.
Yes it is very convenient that your app does something in the background that
is maybe useful, but it's only one app. When you have 30-40 apps installed w/o
auto kill, the battery drainage is terrible.

For me moving from LG to Xiaomi was great in terms of battery life. And yes,
sometimes there are app which shouldn't be killed but it's easy enough to
change their setting in the battery saver. And really these are only few, most
app deserve the auto kill, as they abuse the priviledge of being able to run
in the background.

------
Altheasy
I hate apps that run in background and do not trust it at all, fuck yaah, I
like Android when he stop this shitty apps. 99% of times I'll choose not run
in background if I asked for it by your app.

------
georgeecollins
It is really important to point out when cell manufacturers "improve" Android
in a way that breaks apps. They are doing this for the improved battery stat.
But if even a few users are dissuaded from buying their headset because it has
a poor compatibility rating they will find better solutions. How about a
bigger battery or one that can be exchanged? Or a more power efficient phone.
Both are possible.

------
hateful
All I want is a way to protect certain apps from being closed, or at least be
the last in line to be closed. That way I can make sure the 1-3 apps I always
need are ready to go. And I'm not talking about some instantly loading alarm
clock app. I'm talking about complex games or applications that take some time
to initialize (Star Trek Timelines, for one).

------
sublupo
Battery saving is needed for apps like WhatsApp. Even after doing a force kill
to Whatsapp, a few seconds later, I see that it opened itself. I can't find a
way to close WhatsApp and not have it open until I tell it to. The only option
I could find (for a non rooted phone) is to use a VPN and route WhatsApp to a
non existent address

------
crtasm
Signal's support docs have instructions for various brands of phone. Really
shouldn't be necessary

[https://support.signal.org/hc/en-
us/articles/360007318711-Tr...](https://support.signal.org/hc/en-
us/articles/360007318711-Troubleshooting-Notifications)

------
dangerface
If your app is in the background it shouldn't need a load of resources. These
resource limits are there to prevent bad developers using all your resources
in the background. If you are having issues with this limit you are probably
one of these bad developers. Removing the limit is not the solution, writing a
better app is.

~~~
Traster
So how do you propose to write a sleep tracking app that doesn't run a
background process for longer than 20 minutes?

~~~
dangerface
I have a Xiaomi and oneplus phone, neither of them have ever closed a
background app so I dunno what you are talking about, but if phones are doing
that then, yea fair enough thats a problem.

The wording in the linked website is talking more specifically about cpu
limits, which is how most os manage background resources, whats the problem
with that?

Sleep tracking is a good example you should use an event system, but
developers are lazy and use "while (true) {}", which is my point.

~~~
hiddentruth
Are fitness tracking apps able to run uninterrupted in your Xiaomi phone? Did
you change any relevant settings?

~~~
dangerface
I had a huwaii fit-bit-thing for a few months it uses two apps and I had
issues getting them to talk to other software, but no problems tracking or
shutting down, didn't change any settings. Maybe other apps have problems but
theirs worked fine.

------
Apocryphon
Sad that HTC, perhaps the vendor that's worst off on the list, seems to be the
least bad actor besides stock Android.

------
f055
You gotta love the developers' schizophrenia where on one hand we go batshit
crazy over mass data collection by "malicious" apps, and on the other we fight
with passion for the same apps to just run unmonitored in the background and
collect. "You've got a smart phone but a dumb ass..."

------
Tade0
Recently I limited the number of background processes on my phone(Galaxy S8)
to two.

On one hand lag is essentially gone, on the other I usually have to "restart"
an app(in the Android sense of the word) if I want it to regain focus. E.g.
tabs in Chrome always refresh, which has its downsides.

------
barrkel
I don't have any issue with applications dying unexpectedly or not receiving
expected notifications on my OnePlus.

If anything, my gf's Galaxy is much worse in this respect. She doesn't usually
get Hangouts notifications until she explicitly launches the app.

------
blauditore
That's why I'm happy with Android One (which many Nokia phones come with these
days).

~~~
sorenjan
Apparently the app that kills other apps comes installed on Nokias with
Android One as well.

[https://www.reddit.com/r/Nokia/comments/actk7z/android_one_p...](https://www.reddit.com/r/Nokia/comments/actk7z/android_one_phones_has_the_evenwell_services/)

~~~
pja
It’s there on my Nokia 7+ running Android 9.

~~~
sorenjan
Have you had any problems because of it?

~~~
pja
Not once I turned off battery optimisation for the apps I wanted to run in the
background (BBC Sounds / Radio apps, a couple of fitness related apps.)

The total lack of any feedback as to what was actually killing these apps in
the first place is the problem - the user experience is terrible. The phone
just kills an app that worked perfectly before this release of Android, with
no explanation or notification so the user can correct false assumptions. The
user is left poking about in the settings until they stumble across the
battery optimisation and have an "ah ha!" moment.

------
z3t4
This is a kind of "benchmark" optimization. Perceived battery life is a factor
when users buy mobile phones. And all it takes is one bad app and one influent
user - to kill an entire product, and even a whole brand.

------
hart_russell
I used Android for 9 years until I recently got the iPhone 10s. I'm never
switching back. The only thing I miss is automated profiles using Tasker.
Vertical integration and lack of SKUs has major advantages.

------
EGreg
You need to do this:

[https://hackernoon.com/notifications-in-android-are-
horribly...](https://hackernoon.com/notifications-in-android-are-horribly-
broken-b8dbec63f48a)

------
lgleason
Compared to IOS, Android is very forgiving. That said, it also does a lot
worse with battery life. As an Android dev it can be annoying to work around,
but I appreciate why they have taken these steps!

------
kkarakk
android needs to stop being treated as garbage by google. take the reins, full
control - monetarily fine OEMs who make their own garbage modifications to the
underlying OS and actively harm the user experience. no timely updates? fine.
garbage ux reported by vast majority of users? fine. basically re-implement
nintendo's seal of approval for games but with the help of crowd-sourced
reviews. we have the technology.

but no instead we'll probably get fuschia and android will be deprecated lmao

~~~
scarface74
A lot of the issues are also caused by Google’s poor API design that is not
well thought out causing app makers to have to roll their own solutions.

Google has no motivation to make sure that the ecosystem is good as long as
they can sell ads and collect user data.

------
finchisko
Device manufacturers favoring some apps by putting them on a whitelist to
prevent them from being killed should be considered as unfair practice
(potentially illegal).

------
benbenolson
Does this feature affect notifications?

More specifically, could this be the reason I've recently not received Discord
notifications for DMs?

------
memeograph
What I want to know is why years into its existence, Android still can't stop
waking up the screen for no reason, with no notification displaying. Whatever
app(s) is doing this can still keep doing it to this day, on my #2 poop
OnePlus. So clearly it can't be that bad.

Lock em down. App developers are terrible and have no taste. Y'all had years
to make these devices useful and failed. Instead it's all cloud idiocy.

------
amelius
Just please give me plain Linux ...

~~~
skvark
There is Sailfish OS ([https://sailfishos.org/](https://sailfishos.org/)).
It's a GNU/Linux and has true multitasking.

~~~
amelius
Yes, the problem is finding a good phone that supports it.

------
loriverkutya
> Smartphones are turning back into dumbphones. We have to fight back!

Actually, it is not a bad thing.

------
fenesiistvan
No mention at all about foreground services. That should fix all these issues.

~~~
HughIngram
Some manufacturers don't even respect the foregrounding of services! Our app's
Service runs in the foreground, and is sometimes killed by the OS, e.g. on
Huawei devices. This issue affects spotify too:

[https://community.spotify.com/t5/Android/Music-stops-play-
af...](https://community.spotify.com/t5/Android/Music-stops-play-after-my-
android-phone-goes-to-sleep-mode/td-p/16551)

------
setquk
Is this why the alarm never went off reliably on my Android phone?

(iOS user now)

~~~
Macuyiko
It might be. I never had an issue with this on my previous OnePlus phone
(which at least at the time was pretty close to stock Android), but I was
stumped to see that the Google Clock alarm was not going off multiple nights
(seemingly at random) on my new Huawei phone. Turns out the phone was closing
the app in the background due to it running for a long time... huh.

Switching the the built-in clock app (it's whitelisted, probably) fixed the
issue, though it's not a good user experience. (To note: there is a settings
screen to override per-app background closing behavior, but for an alarm clock
I don't mind so much which app I end up using.)

It is pretty annoying still having the whitelist e.g. VPN apps manually whilst
travelling as the phone was closing them constantly.

~~~
setquk
Interesting. Mine was a Motorola handset. I gave up with Android in the end
due to stuff like this. I don't want to have to fight the tech I use to keep
it doing what I want it to do.

------
DanCarvajal
App vendors, don't abuse background tasks.

------
PaulHoule
App publishers, don't kill my battery!

------
Kiro
Custom alarm clocks and health trackers work fine on my OnePlus. What is the
problem exactly?

~~~
nallerooth
I had problems with synchronization between my OnePlus 3 and my Fitbit tracker
(it'd work fine for an hour or a day and then just stop), but those problems
went away when I upgraded to a OnePlus 6T. Regarding slack notifications and
similar things, all I can say is that they sometimes appear a few seconds
later than on my active desktop, but I don't find that delay to be a problem.

~~~
SmellyGeekBoy
I had problems with my FitBit and other Bluetooth devices on my OP3 running
stock firmware but these have all been resolved since I moved to LineageOS.
Battery life seems better too (although I haven't explicitly measured).

------
scoot_718
Fuck your app, Android vendors, please kill background tracking and bullshit.

------
envisionint
This is so true.

------
sonnyblarney
Google had better understand this kind of fragmentation is what makes their
platform useless.

It's fine for vendors to do specific things, but it has to be very clear,
documented, and within certain parameters.

Google has to realize that _they_ are responsible for coordinating and
publishing this information, and making sure it's clearly communicated to
developers.

That they don't grasp this is byzantine.

There's a corollary in tech, relating to how many API's are released without
proper documentation, thereby rendering all of the 'hard work' of making the
software basically useless.

I should add: dealing with these kinds of problems are quite fundamentally
different than other engineering challenges. For some reason, while working on
this stuff, I can't help but feel frustrated and angry, mostly at Google (and
the vendors) - because we're essentially 'solving their stupidity'. It's
costing you money, and many small businesses don't have spare money and risk
to hand out. It seriously strains developer relations and perpetuates an
existential notion that developers have been 'lied to' by the platform
vendors.

------
ratling
90% of the time you don't need to constantly run crap in the background
scooping up my personal information, thanksno.

------
15characterslon
tl;dr The author would like to run his app in the background without notifying
the user about it, because otherwise the author would just add add an ongoing
notification, which would allow the app to run in the background forever on
all platforms.

~~~
lucb1e
If this were the solution, I'd have to have a notification that I can't swipe
away for email, Telegram, Wire, navigation while navigating, music player
while playing, alarm clock when an alarm is set... So say I'm driving with
music, that's five useless notifications. The app can ask me on first launch
if I want it to do this or not, rather than being permanently in my face about
it.

The notification area is becoming increasingly useless (for actual
notifications). Since upgrading from 4.4 to 7.0 last year, this has been
bugging me quite a bit and I haven't yet found a solution. I was much happier
with the old OS, but security updates...

~~~
zozbot123
You can set the notification to "Hide" in the App properties screen. You don't
have to swipe it away/close it.

~~~
lucb1e
But then it hides all notifications. I still want to know when I received a
new email or message.

Again, Cyanogenmod based on Android 4.4 was better here: I could selectively
hide notifications with certain contents. In Android 7, I can only choose not
to display notifications from a certain app. I still have to write something
that reads notifications and kill them selectively, but then I guess such a
service would get killed as well without its own annoying notification... (The
"you must update google play services to use this app" notification (which is
a falsehood) is also annoying the crap out of me, another issue I didn't have
on 4.4.)

I didn't actually know the wake lock would still work if you hide an app's
notifications, I thought the notification was the prerequisite for not getting
killed.

------
silversmith
I haven't followed the scene closely, but isn't it the same behavior as Apple?
Can you even do background tasks in iOS?

~~~
wingerlang
As a developer, you are aware of the limitations so that you can work with
them. E.g. when your app is closing down you have X ms to wrap your work up.
But you can also request a longer task, or request the app to work in the
background in certain scenarios. And as there is only 'one iOS', it will
always work as 'agreed on'.

It seems like in Android the developer just assumes their app will be able to
run in the background, except some versions just decides to kill it based on
their own agendas.

~~~
izacus
> It seems like in Android the developer just assumes their app will be able
> to run in the background, except some versions just decides to kill it based
> on their own agendas.

That hasn't been true for some versions now. Yes, there's a mode where apps
can run in the background without restrictions, but that hasn't been true for
most apps for years now.

------
finchisko
I don't understand why manufacturers are trying to solve problem for user.
User has power uninstall app that is draining battery or replace it with
something else. There is rating and comment section in app store exactly for
this. What they could do instead is to display warning that app is using too
much battery, but they SHOULD NEVER KILL AN APP.

It may sound radical, but only countermeasure we developers have is to block
installments of our apps on such devices until moment manufactures stop doing
this nasty "optimizations". It's like taking users as hostages, but that
exactly what manufacturers are doing as well.

PS: for all down voters, I would like to hear from you if you just android
user or you've also developed some app (I doubt you did).

~~~
Jonnax
The user experience is more important than a app developer's need.

Users want better battery life. They don't want a app using it up.

Feel free to block the installation of your app on devices that you feel
unfairly target background apps, they'll just use a different application.

~~~
finchisko
>Feel free to block the installation of your app on devices that you feel
unfairly target background apps, they'll just use a different application.
reply

with some devices you just can't find alternative that would work reliably in
the background for example. Imagine sport tracker, that needs to record
locations even when in background. You cannot just use another app, because
any sport app could get killed due excessive power management.

Favoring some apps by manufacturers putting them on a whitelist to prevent
them from being killed should be considered as unfair practice (potentially
illegal).

