Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android, what really happens after force closing an application?

I have an stock market application. When user login to application, server sends me a session key. This session is valid until user logout the application or don't do anything for several minutes.

My first problem (that is solved already) was when after login to application, user click home button and after that click on icon of application. Now, after login, a message (sent by server) showed "your user id is in use". I have solved this issue by saving session id in shared preferences.

Now, the client reported that we have same issue based of this story.

  • User login to application
  • After that user clicks home button
  • User goes to settings/applications/manage applications
  • Selects application and then in "Application Info" page, clicks on Force Stop button
  • User comes back to application list again and selects the application
  • After login, "Session Expired" message will show and application directed to login page again
  • Now, when user try to login, the above message ("your user id is in use") will show while session id is not expired.

I want to know, what "Force Close" button really do? Does it clean all instances of activities? When I click and hold Home button, I can see that I still have an instance of the application in memory. Therefore, what is the role of "Force Close" button?

  • Now, if user enter his/her password "your user id is in use" will show again.
like image 674
Hesam Avatar asked Jan 23 '26 07:01

Hesam


2 Answers

When any application is ForceClosed.

The Application is Closed and Android Clears all the memory occupied by the Application.

That's why when you force close the application your static data member's are destroyed and removed from the memory. Here,You can use SQLite DataBase for better performance.

ForceClose Means : Close the Running Application and Free the Memory.

like image 181
MKJParekh Avatar answered Jan 24 '26 22:01

MKJParekh


Your question has been answered, but I'd like to add one point. You mention that

when i click and hold Home button i can see that there is still i have instance of application in memory

Please note that what you see when you long press the Home button is the list of recent apps and not the list of apps currently in memory. Hence, even if an app has been force-closed, you will still see it in this list since it was recently used.

like image 26
curioustechizen Avatar answered Jan 24 '26 20:01

curioustechizen