0

In my app when i press home button and open the app from menu or shortcut it returns in the same screen but the pid of the process is killed.

BUT

if i hold home button and choose my app from there it will resume normally

This problem is not happenig in all devices 2.2.1 and 2.3.5 samsung galaxy Ace

if is solved again ( i doubt i lost many hours searcing) please link the answer

Thanks in advance

EDIT

In 2.3.6 Samsung Nexus S doesn't happen.

ConJoBa
  • 98
  • 7

1 Answers1

1

You shouldn't worry about that. The whole Android ecosystem is built around the concept of never terminating your application yourself, and letting the OS handle that aspect of things, and it's working very well if your app is written following the good practices.

Make good use of the Activities lifecycle methods (onPause, onResume, onStop, etc.), and everything will work smoothly, whether your app has been effectively terminated or kept in the background by Android.

Guillaume
  • 22,694
  • 14
  • 56
  • 70
  • thanks and i study really hard but the problem is that in those phones the user must re-login in my app beacause everything is erased and not kept. Also isn't strange that on menu is killing the process but from the home -recent activities not? – ConJoBa Feb 03 '12 at 14:53
  • Make good use of the Activities lifecycle methods (onPause, onResume, onStop, etc.), and everything will work smoothly, whether your app has been effectively terminated or kept in the backgriound by Android. I works great but in some devices is behaving like this not in all so i assume my method are ok. – ConJoBa Feb 03 '12 at 14:54
  • 1
    Each phone / OS version handles memory and process termination with a (relative) level of freedom - that's one reason why you shouldn't make assumptions on whether the application has been killed or not (a bit like a web app) - To address the specific problem of login, you could use a SharedPreferences to "keep" the credentials (as long as you encrypt the password) and retry them automatically? – Guillaume Feb 03 '12 at 14:56
  • Also, that could be useful to you: http://stackoverflow.com/questions/785973/what-is-the-most-appropriate-way-to-store-user-settings-in-android-application – Guillaume Feb 03 '12 at 14:58
  • Thanks for these advices are really good and i follow them. But my worry is that strange behavior between those actions (the home-recent app (which is the desired and logical behavior) and the launch from apps where resumes in the same screen and has the stacktrace kept but averything is null) – ConJoBa Feb 03 '12 at 15:03