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
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
It was my impression that these devices kill even the apps doing this, are you saying it's not so?
I'm saying that this is the best way to run tasks in the background. It will work on most devices most of the time.
The meaning of "kill an app" is not so simple. Is the app killed and later restarted? Maybe the app is only paused?
I'm pretty sure that most new devices will not allow an app to prevent the device from sleeping without restrictions.

Developers who own a Nokia device should try it and see whether the background location app continues to update the location after several hours.
 
Upvote 0

Sandman

Expert
Licensed User
Longtime User
There is a posted issue in their Github project about whether foreground services would work to prevent the killing, and this was the response:

We've tried this solution in our app, unfortunately with no luck. It does not prevent crappy manufacturer customization to kill the apps. For sure it's a bit better, but does not last more than one hour or 1 day...

It's in fact the main goal of this project : the official Android documentation describe multiple solutions to keep our app alive and run our process (foreground service, task manager...) but it only works on stock Android. The manufacturers listed in the dont-kill-my-app project breaks the stock and documented behaviour.
 
Upvote 0

Pendrush

Well-Known Member
Licensed User
Longtime User
Almost all Xiaomi devices will kill app even if service is in Foreground. Half of Huawei device will kill app in foreground, 20% of Samsung low end devices will kill app in foreground.
I have an app with foreground service and I have a lot of problem with named devices.
 
Upvote 0

Pendrush

Well-Known Member
Licensed User
Longtime User
I don't have any of these devices, but i have an app with 260k+ active installations, and all complains come from Xiaomi, Huawei and some low end Samsung devices, no matter of Android version.
App is running music in foreground service with exo player. When user listening music after few minutes with screen turned off, device kill app. On some devices after 2 minutes, on some after 10 minutes. No trace of any error in foreground service in Crashlytics. I'm also using partial lock, and have test app on at least 10 different devices without problem. App running fine on most devices (have 4.8 average rate on play store).
 
Upvote 0

Sandman

Expert
Licensed User
Longtime User
use StartServiceAt to schedule the app to start every 30 minutes

Yes, that would be interesting to see if that made a difference for you, @Pendrush. Is that something you already do, perhaps? Willing to test, if you're not?

Something else I was wondering, @Erel, and I do realize that this is difficult to answer without have a device to actually test on, but do you think that geofences still work as expected even though the device has overly aggressive killer instincts?
 
Upvote 0

Pendrush

Well-Known Member
Licensed User
Longtime User
I will try to include REQUEST_IGNORE_BATTERY_OPTIMIZATIONS, maybe this help on problematic devices.
App will be updated in this month. I will report back my conclusions.
 
Upvote 0

ac9ts

Active Member
Licensed User
Longtime User
I will try to include REQUEST_IGNORE_BATTERY_OPTIMIZATIONS, maybe this help on problematic devices.
App will be updated in this month. I will report back my conclusions.

Be warned, The great Google flagged my app for having REQUEST_IGNORE_BATTERY_OPTIMIZATIONS and they requested I remove it. My app does the same as yours (plays streams with Exoplayer, foreground service, etc.) and I have the same issues with users saying the app shuts down after some time.
 
Upvote 0

Sandman

Expert
Licensed User
Longtime User
Is there even a way to catch this closing event so that I get a warning everytime the app is killed?

It's probably a good idea to remember that this behaviour is something implemented by the vendors to kill bad apps. (As I understand it, in China a lot of Android users are getting constantly bombarded by notification ads.) Therefore they aren't really aiming for a polite and developer friendly solution. They're bringing out the big guns, and us developers doing sane apps that actually provide value to the users are simply collateral damage.
 
Upvote 0

KMatle

Expert
Licensed User
Longtime 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".
 
Upvote 0
Top