Sumedh Deshpande
Sumedh Deshpande

Reputation: 165

Need help for closing my android app

I am developing an Android application. I want to quit my application but application should be in running state in background. Whenever I click on application application should start from last quit point. I dont want to login again.

The same thing is happening when I press home button. But I want to implement similar functionality like Home button on my own button event. How should I proceed with that??


But though I have finished all other activities, still I need to login again. When I finish the activity my session ends there. And on next app start with login screen.

Whereas in case of home button click, it keeps my session and on next app start my app check onResume() event where I am checking whether session exist or not. If session is there I can enter directly into my account.

So Anybody have any idea what exactly android does when we press home button.

Upvotes: 0

Views: 127

Answers (1)

Shlublu
Shlublu

Reputation: 11027

Android is designed this way: you don't need to explicitely terminate your applications, the system does it for you.

You just have to terminate the Activities or Services by calling Activity.finish() or Service.stopSelf() to see your apps behaving as you described.

Should there be any log-in process, just store the needed information in a SharedPreference to make your application able to re log-in for you or to use the token obtained at login time (depends of the way the process is designed). More details on SharedPreferences here.

Upvotes: 1

Related Questions