Android Question ”Hey Android vendors, don’t kill my app!”

Sandman

Expert
Licensed User
Longtime User
This is a brand new site that I thought would be worth a visit from B4A users. It lists and ranks different phone vendors on how badly they cripple installed apps to squeeze out a little more battery.

Don’t kill my app!
https://dontkillmyapp.com/

upload_2019-1-15_9-7-5.png



The bigger question is, what can we as developers do about this? Here's some ideas on top of my mind:
  • Star their Github project, it helps bring attention to the project
  • Submit info you have on phones back to the project
  • Implement workarounds (some are suggested on the site)
  • Inform our users (gently) that their phone is overly aggressive
  • If you have a friend in the media that might be interested, point them to the site
 

Erind Jushaj

Member
Licensed User
Could you describe what app is doing when running in foreground mode? Exactly: Why do you need to run it 24/7? I use FCM to trigger my apps when needed (e.g. new data, do some stuff in a service, etc.). Maybe we get closer to the problem via "what is an app doing vs. why is it killed".

I am sending a http request to an api website to get some real time price data which is downloaded as Json and further processed. The main idea is to have real time Stock Prices. An example website: https://min-api.cryptocompare.com/data/pricemulti?fsyms=ETH,DASH&tsyms=BTC,USD,EUR
 
Upvote 0

techknight

Well-Known Member
Licensed User
Longtime User
Add Lenovo to this list. One of our newest Tab4s has Android 8.0 and its a problem!

Everything works fine, even when the App has the screen locked, is in the foreground, has a foreground service with notification loaded, Still after 15 minutes, or sometimes longer, it kills off the service which kills the bluetooth connection.

This is even when a person is using it and interacting with it. Its our controller app for our scoreboards so thats a huge problem considering that IS our market...
 
Upvote 0

Sandman

Expert
Licensed User
Longtime User
Add Lenovo to this list. One of our newest Tab4s has Android 8.0 and its a problem!

Did you try this?

For an app to work in the background:
  • enable the padlock icon at an app in the right top corner in the overview of running apps. It’s only then actually running as a foreground process. If you swipe it away, its background process will be killed mercilessly.
It does not matter if the battery/power optimization is on or off in Settings -> Apps, .

Quoted from: https://dontkillmyapp.com/lenovo
 
Upvote 0

Martin Larsen

Active Member
Licensed User
Longtime User
The background location tracking example was killed within an hour on my Huawei P20 Pro. I had to exclude it from power management. But then it seems to keep on running, at least for a day now.

One thing is that it gets killed, but how come it doesn't start up again at the time set with StartServiceAt?
 
Upvote 0

Sandman

Expert
Licensed User
Longtime User
One thing is that it gets killed, but how come it doesn't start up again at the time set with StartServiceAt?

My best guess is, and I quote from my post #18:

It's probably a good idea to remember that this behaviour is something implemented by the vendors to kill bad apps.

I mean, let's assume we acted in bad faith and was trying to make one of those bad apps that spray ads in notifications and are a general nuisance. One of the first things that we would try would be to schedule a restart of our app, to get around the killing. And to combat that the vendors would make sure to cancel all our schedules when they kill the app, to make sure we stay dead.

They're bringing out the big guns, and us developers doing sane apps that actually provide value to the users are simply collateral damage.

Of course, I have no actual insight into the vendors reasoning. It's all speculation from me, but as far as I can tell it seems to fit what's going on.
 
Last edited:
Upvote 0

Martin Larsen

Active Member
Licensed User
Longtime User
You are probably right. However after trying Locus Maps on my P20 Pro I am getting even more confused.

Locus is a hiking app (and much more) that I have used for years. One of its main features is actually a GPS tracker that can record your walks. I was curious how it worked on my new Huawei so I started the tracker function yesterday.

It is still running, tracking my location. And I have done nothing to bypass power management for this app. It's handled 100% by the phone.

What it Locus doing in order not to get killed? And why shouldn't we with B4A be able to do the same?

One hint could be that so far the phone haven't complained about the app using power. That happened with the example app. So maybe Locus behaves better when it comes to using battery?
 
Upvote 0

Sandman

Expert
Licensed User
Longtime User
after trying Locus Maps on my P20 Pro I am getting even more confused
First of all, can you link to the exact app you're talking about? There are numerous apps with that name, and I'd like to see which one we're talking about.

What it Locus doing in order not to get killed?
Well, a quick analysis from me would conclude that either they have managed to get into a pre-populated whitelist so their app isn't killed. Which could be completely possible, and still not in any way visible for you as user. On the other hand, if that's not the case, they seem to be doing something right.

One hint could be that so far the phone haven't complained about the app using power. That happened with the example app.
I don't really know enough about this to be sure. Please post the link to the app, and then perhaps we can ask Erel to see if he can find something that might be a clue to what's going on.

One thing that you might try, if you feel like it, is to uninstall the Locus app, and re-install the background location tracking example app. But this time use the exact same app id, and app name, as the Locus app. If it doesn't get killed (or the phone doesn't complain about battery usage), that would very much indicate that there's a whitelist in play. (It's not conclusive, but it would be a huge hint.)
 
Upvote 0

Martin Larsen

Active Member
Licensed User
Longtime User
Sorry for not linking to the app. I use the Pro version but the free version probably behaves the same.

It's a good idea uninstalling the Locus app. It has a settings backup function, so I can easily restore it later.

I will try your suggestion by renaming the test app tomorrow.
 
Upvote 0

OliverA

Expert
Licensed User
Longtime User
Upvote 0

Martin Larsen

Active Member
Licensed User
Longtime User
One thing that you might try, if you feel like it, is to uninstall the Locus app, and re-install the background location tracking example app. But this time use the exact same app id, and app name, as the Locus app. If it doesn't get killed (or the phone doesn't complain about battery usage), that would very much indicate that there's a whitelist in play. (It's not conclusive, but it would be a huge hint.)

It's really interesting. I made a version of the demo app and called it Locus Map Pro and gave it the id menion.android.locus.pro. No other changes. Then I uninstalled Locus Map and installed the new demo app instead. The original demo app is still installed with the id b4a.example.

I start the two apps at the same time. The original example is killed within minutes. The new called Locus Map Pro goes on for hours. No complains about battery usage.

So it does indeed seem like there is some kind of whitelisting taking place. Not sure if this is an online list the OS is pulling from, or if it a kind of reputation system (it is know by the OS for a long time etc). Surely, it cannot be baked into the OS.

It would be really interesting if someone would replicate the experiment! Preferably someone that doesn't have Locus Map installed already.

@OliverA : I will try the workaround.
 
Upvote 0

Martin Larsen

Active Member
Licensed User
Longtime User
And just after my post I thought about something else. What if b4a.example instead has a "bad" reputation? After all, a lot of demos I have tried was just called b4a.example.

I will try compiling the app with another id.
 
Upvote 0

Sandman

Expert
Licensed User
Longtime User
Very interesting result, Martin.

I start the two apps at the same time. The original example is killed within minutes. The new called Locus Map Pro goes on for hours. No complains about battery usage.

Just to be absolutely certain that there's nothing else in play, can you please restart your phone and do the same test again?


I will try compiling the app with another id.

That's smart.
 
Upvote 0
Top