Take the 2-minute tour ×
Android Enthusiasts Stack Exchange is a question and answer site for enthusiasts and power users of the Android operating system. It's 100% free, no registration required.

Is there a difference between leaving an app by pressing the "back" button vs. pressing the "home" button?

I've got an app which includes a countdown timer. The app says it will notify me when the timer reaches zero but only if the app is minimized (home button) and not if it's closed (back button). Is there really a difference here?

Note that I've confirmed that the app stays available in the list of running apps (the "history" button, or whatever it's called) regardless whether I use "back" or "home" so I am confused. Has the developer misunderstood this?

Details: I'm running the app Ingress Portals on a stock Nexus 4.

share|improve this question
2  
A quick note about the "list of running apps": it's not a list of running apps, it's a list of recent apps. Having an app in that list doesn't mean it's running, and you don't need to remove apps from the list to "save battery" or "save memory". Conversely, an app could be running a Service and not be in the list at all. –  Dan Hulme Apr 7 '13 at 9:05
add comment

2 Answers

up vote 4 down vote accepted

In general, when you leave an app with home, or by launching another app from the recents menu, Android keeps the state of the app around for a while. That includes the stack of which screens you've looked at, the position of scrolling things, selected items, the state of checkboxes and the text in text fields, and other such things. It'll only discard that state if the device runs low on memory, or if you don't come back to the app for a long time.

If you instead press back, it takes the current screen off that stack, throws away that state, and goes to the screen you were looking at before. Repeated back presses keep doing this until you're all the way out of the app, and it has no state left. (Note that this is only the state of the screen as I described above. The app ought to save any persistent state, such as the document you were editing, or your high score.)

As Sachin Shekhar says, use home if you want to come back to the app in the same state; or back if you are done with the app and you want to see the main screen or starting screen next time you start it. In addition, note that apps can change the behaviour of the back button (such as how web browsers usually make it go "back" in the browser instead of leaving the browser completely), but they can't change the behaviour of the home button. You can always use home to get out of a misbehaving app.

There's one more thing. Android also allows apps to create what it calls a Service. This is a part of the app that runs in the background, with no visible part (unless it sends notifications). Any app that has a long-running task to perform, such as a download manager, or a torrent client, should use a Service so that the download keeps going even if the app isn't on your screen. It should make sure the Service exits when all downloads are finished, so you don't need to worry about how to exit it.

Perhaps this app is using a Service to run the countdown, and it has changed the behaviour of the back button so that as well as leaving the app, it also stops the Service. That could be why you get that instruction. But it's only that way because the author chose to do it that way: he could just as easily enable and disable the countdown with a checkbox or button inside the app. It's not standard behaviour, and in general, you shouldn't expect to have to use home to keep downloads or long-running tasks running.

share|improve this answer
add comment

Generally, Back button calls onDestroy() method of current activity. But, Home button pauses the activity. This is the difference if a developer follows standard guidelines (a developer can choose not to respect this behavior).

In layman's term, when you exit app with Back button and start it again from Recent Apps list, it'd be app's fresh launch. And, when you exit app with Home button and start it again from Recent Apps list, the app would be resumed from where it was left. It means that Back button kills an app whereas Home button sends an app to background (Android memory manager can still choose to kill it if system runs out of memory).

The app in the question is simply showing standard behavior.

share|improve this answer
    
What a difference! That is absolutely not clear to me as an average user. So you're saying I should not use back, except to dismiss a menu or similar. –  Torben Gundtofte-Bruun Apr 6 '13 at 20:34
    
@Torben You can use Back button to exit the app if current session isn't important to you. If you just want to pause the session or you want to run app in background while using another app, use Home button. –  Sachin Shekhar Apr 6 '13 at 21:03
    
@Torben Example: Let's say there's a torrent download client following standard behavior. If you want to stop the download (to save battery and/or internet congestion), use Back button. And, if you want the app to continue the downloading while you read an ebook or surf the web, use Home button. Its not that hard to understand (think about multitasking of PCs). –  Sachin Shekhar Apr 6 '13 at 21:08
    
I'm not saying that it's hard to understand -- it's just that it's absolutely not evident from simply using the phone. Now that I know, it's easy enough to remember, but from a user perspective, there doesn't appear to be any difference unless you deliberately try it out (but even then you would still need a hunch about what you're going to test for). –  Torben Gundtofte-Bruun Apr 7 '13 at 11:14
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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