Android how to avoid closing the user's session when the app is removed from the background


How can I achieve that when the user minimizes the application with the home or back button and then removes it from the apps running in the background does the session not close?

It turns out that you log in correctly with Google+, but if the user is out of the application, it eliminates it from the background activity, the user's session is closed and when you open the app you have to log in again. How can I keep the session from starting?

asked by Nicolas Schmidt 21.08.2016 в 21:22

1 answer


If you delete it, it is natural that when you want to open it, start again.

This also happens if you open several applications (try this to verify what I mention) and these require memory, the operating system requires this memory and although it is in the background, if you try to open it, it will start again.

If you do not want your application to start, for example, from a Splash Screen, you must implement that it saves certain data that allows you to start the session from the beginning, although this would not be entirely true since you would start the Activity again and even execute the session. method onCreate() .

answered by 21.08.2016 в 23:28