Hacker News new | ask | show | jobs
by sebtron 943 days ago
Can't you close your apps when you don't want them to stay open?

The reason I first discovered "don't kill my app" is that my apps would close as soon as I switched to another one, in most cases. For example if I used maps and switched to a call / browser tab / Telegram chat, when I got back to the map my search would be gone.

So no please, don't kill my app when I don't want you to.

2 comments

Not sure what you meant by that - mobile apps don't have main() or exit(), they are driven by onThingsHappen(Event event) calls. When the OS decides to call `onYourAppIsResumedFromAltTab(context SwappedOutMemoryContent)` instead of `onYourAppWasJustLaunched(void)`, your app can resume functioning. The former is more likely to happen on devices with larger RAM space. You as an app developer don't have full control over it, unlike how it is(used to be!?) with Win32 apps.
As a user, I can swipe up and hold from my home screen (depends on your launcher probably) and "swipe away" the apps I want to actually close, as in remove from the background. Not all of them comply, though.
Unfortunately it doesn't work like this. You can close the app, but app will wake up on any event - timer, call from server, any system event, etc. etc.