When Does An Application Close?

Discussion in 'iPhone' started by donm3ga, Aug 22, 2008.

  1. donm3ga macrumors member

    Joined:
    Aug 19, 2008
    #1
    I am new to the whole iPhone thing. I picked up my 3G about 3 days ago and am following all the guides out there, especially the battery guide.

    My question is do applications fully close when you hit the home screen button? I think they do, but when I go back to the application it picks up right where it left off which makes me think they never closed in the first place. Now if they closed when I hit the home screen, and pick right back up where it left off when I go back into it due to memory or something...then thats a win/win.

    The iPod doesnt close right?

    Thanks for the help. If someone could forward me a link that has the general use or how an iPhone works that would be greatly appreciated.
     
  2. DavidLeblond macrumors 68020

    DavidLeblond

    Joined:
    Jan 6, 2004
    Location:
    Raleigh, NC
    #2
    The application is fully closed and removed from memory when all the icons have finished moving back into location on the home screen. IF the application picks up when you left off when you re-enter it, that is because it has saved a file in its Document folder that contains whatever it needs to APPEAR to pick up where it left off.
     
  3. soberbrain macrumors 65816

    soberbrain

    Joined:
    May 9, 2008
    #3
  4. cellocello macrumors 68000

    cellocello

    Joined:
    Jul 31, 2008
    Location:
    Toronto, ON
    #4
    I get the impression that it takes a few seconds after pressing the Home button before the app is fully unloaded.
     
  5. Nicolecat macrumors 6502a

    Nicolecat

    Joined:
    Apr 2, 2008
    #5
    Yeah...I read somewhere to hold your home button down for 5-8 seconds before releasing and this will fully close your program, so it's not running in the background wasting battery.
     
  6. Interstella5555 macrumors 603

    Interstella5555

    Joined:
    Jun 30, 2008
    #6
    That's not quite true... Trism, for example, can be played while listening to music, and will receive phone alerts while in game. If the dev didn't implement the function, it won't be there.
     
  7. daihard macrumors 6502a

    daihard

    Joined:
    Feb 19, 2008
    Location:
    Seattle, WA
    #7
    I don't think it's true. As DavidLeblond said in #2, any application should fully close with the press of the Home button. Holding down the Home button for several seconds forces the application to quit; for instance, when it hangs or starts acting up.

    The only exception to this rule is the Apple-provided built-in iPhone apps such as iPod. Even in that case, Apple does not keep the whole application runnig in the background. It is usually just stubs, or in case of iPod, the music playback app that's a lot smaller than the iPod app itself.
     
  8. soberbrain macrumors 65816

    soberbrain

    Joined:
    May 9, 2008
    #8
    Ah, good to know. I haven't come across apps with sound that allowed the iPod to play music, too.
     
  9. Consultant macrumors G5

    Consultant

    Joined:
    Jun 27, 2007
    #9
    WRONG WRONG WRONG


    Official Apps, except for a select few Apple Apps such as iTunes, are not allowed run in the background.

    When you hit home or go to another app, the status of the app is SAVED and the app is closed. When you go to the app, the app is launched and reads the saved status to put you back to where you are.
     
  10. Nicolecat macrumors 6502a

    Nicolecat

    Joined:
    Apr 2, 2008
    #10
    No need to yell...So, this is true for official apps...I get it.

    I was simply stating that I had read that information on an iphone tips and tricks article....heck, it may have been a you tube video review for all I remember.
    ...but I wasn't making it up, and I'm not blonde. It sounded like perfectly legitimate reasoning.

    Plus...what would you "f" up if this was how you were to close your apps?
    Is it harmful?
     
  11. question fear macrumors 68020

    question fear

    Joined:
    Apr 10, 2003
    Location:
    The "Garden" state
    #11
    Holding down the home button is helpful for Apple apps that run in the background like Mail. If Mail hangs due to a connection issue, a large attachment, etc, holding down the home button will close the existing connection. Not doing that sometimes means Mail is still trying to connect and that can send calls to voicemail (if you are on Edge.)

    The home button trick will only work with background running apps: Safari (if downloading a website), iPod, Mail, etc.
     
  12. daihard macrumors 6502a

    daihard

    Joined:
    Feb 19, 2008
    Location:
    Seattle, WA
    #12
    You mean by holding down the Home button? You're essentially already screwed up if you have to use that method to force-quit an application, so there's not much more you EF up. :)
     
  13. O. Frabjous-Dey macrumors regular

    Joined:
    Dec 6, 2006
    #13
    I think that holding down the Home button is like Force Quit in desktop OS X. You're quitting either way, but Force Quit breaks out of an application even if it's hung. Of course, it doesn't get to do its saving/cleanup functions if it has any.
     
  14. daihard macrumors 6502a

    daihard

    Joined:
    Feb 19, 2008
    Location:
    Seattle, WA
    #14
    There you go. Exactly what I meant above (#12). :)
     
  15. Nicolecat macrumors 6502a

    Nicolecat

    Joined:
    Apr 2, 2008
    #15
    Yeah...I suppose that was the answer I was looking for. :D
    Except, I was leaning more towards this...What would you EF up if you weren't screwed in an app and you did close it by holding down the home button?
     
  16. daihard macrumors 6502a

    daihard

    Joined:
    Feb 19, 2008
    Location:
    Seattle, WA
    #16
    It depends upon how the "force-quit" process works inside the iPhone. If it attempts to send a "normal-quit" signal to the application first, then the application will be able to perform the standard "exit" procedure (i.e. save necessary information). Otherwise, any unsaved data will be lost even if the application is running normally when the "force-quit" signal is issued.
     
  17. Niiro13 macrumors 68000

    Joined:
    Feb 12, 2008
    Location:
    Illinois
    #17
    If I remember correctly, applications have twenty seconds or so after the home button is hit or a call is received in order to do stuff like take the instance of the application so you don't have to restart from the beginning or the developer isn't required to take states every second. This is also why AIM doesn't seem to reconnect if you accidentally tap home then tap it again.

    The only applications that remain in the background is the iPod application, Mail and Safari (to an extent that is...that's why some applications recommend force quitting Mail and Safari...applications like Teleport for example).

    You should only have to force quit if the application hangs or if you're getting more memory by force quitting Safari/Mail (in that case, why not just restart the iPhone...:/).
     
  18. jaggunothing macrumors regular

    jaggunothing

    Joined:
    Jul 30, 2008
    Location:
    Bangalore, India
    #18
    i think applications quits after a few secs when you hit the "home key", use a app which connects to 3G or EDGE and then watch the data usage in settings. Data usage stops in few secs.

    Long press on home key is for force quitting i guess, when apps hang.
     
  19. skwoytek macrumors 6502a

    Joined:
    Feb 15, 2005
    #19
    As mentioned, holding the home button is a force quit and no current app state data is saved. Also as mentioned, tapping the home button completely quits every third-party application and most native Apple applications.

    The application state is never saved on a force quit. This is because that last state could have been the reason the app was locked up. Additionally, a force quit is a command to the OS, not the app. The app loses all control to execute save and cleanup processes.

    You can see how in some apps, particularly productivity apps, force quitting could be very undesirable if current data is not saved.

    Here's an example of what happens using the app MotionX Dice, but the result is the same with all apps to some degree*.

    Roll dice.
    Hold two dice and keep three on the table.
    Now exit normally by tapping the home button.
    - The game state is saved.
    Upon reopening MotionX Dice your dice look as they did when you quit.
    - The same two dice in the hold tray and three on the table.
    Now put all the dice back on the table and roll again.
    This time save four dice and keep one on the table.
    Now exit by holding the home button until the app force quits.
    Upon reopening the app looks for the file which holds the last app state.
    Since the app was force quit, the app state was not saved and the previous save state file still remains.
    - The old state of two dice in the hold tray and three on the table reappear and the last session's data was lost.



    *Some apps write the current state to another file after significant user events. Safari is an example of this.

    On older iPhone OS releases, force quitting Safari would cause you to reopen to the pages you were on the last time you normally quit safari losing any pages opened during the last session. Now, each time you load a page in Safari that page is saved to an "open webpages" file and opening Safari after a force quit will now show all the pages you loaded during the last session before the force quit. However, Safari will not open to the page you were viewing last (which is desired and is the behavior of quitting normally)- this is in case the page you were viewing last was hanging and the reason you force quit Safari. Reopening to that page would put you in an endless loop on the hanging page. So you still lose app state, but to enhance the experience you still retain all previously open pages.

    ... a long winded way of saying, don't force quit applications unless your having problems with that specific application.
     
  20. RobLikesBrunch macrumors regular

    Joined:
    Aug 1, 2008
    #20
    Apple clearly states that any app developed for the iPhone CAN NOT run in the background (which is why no one has introduced copy and paste). If it does run in the background, Apple will not allow it to be sold on the App store.
     

Share This Page