I noticed in Galaxy Note N7000 with Android 4.1.2 that the default music player has 'End' option in the menu, it is not a problem or a bug, but I never noticed this option in any other Android app, so I am curious to know its purpose from design/ coding/ app lifecycle perspective.

Please see the image attached enter image description here


I don't know about this app specifically, but I can answer based on the usual behaviour of music players. If music is playing when you leave the app the usual way, the app starts a foreground service to keep playing the music. This is a special kind of service: it shows an "Ongoing" notification and Android will not kill it to free memory, unless it's really desperate.

Sometimes, this is exactly what the user wants: you start playing music, switch to another app, and the music keeps playing. But sometimes, it's not clear how to make it stop, and avoid the foreground service taking up memory. The "Close" option gives you an obvious way to do this.

In most cases, app authors shouldn't add a "Close" option, because it confuses users (just as you've been confused here), and because the Android app lifecycle doesn't work that way. In this case, the potential for confusion caused by the foreground service is greater, so it's a sensible trade-off.

  • Good explanation, Dan (+1 from me). I'd wish more apps had a close button (or at least offer a close option in a menu), so I could decide which app I do not feel important enough to be kept running while Android might decide otherwise, and kill something I do feel important ;) – Izzy Nov 6 '13 at 12:32
  • @Izzy Android will never kill a running service before an activity that's not on the screen. The real option you want is the setting that controls whether the app syncs/updates in the background. – Dan Hulme Nov 6 '13 at 12:55
  • I know. But take this example: I'm reading a big book in my eBook reader, and do so whenever there's a break (e.g. while in the subway, or having to wait for xyz). Now I need to check for something, make a call, am getting busy. Cycling through many apps, maybe even bigger ones. I want to fast-return to my reader at any point, without having it to reload the book evertime I switch to it. So I rather want to exit Maps, or whatever big app I used in between, so my reader is kept in memory. But as maps runs a service, it would be the reader which is quit by the system unless I can quit maps. – Izzy Nov 6 '13 at 14:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.