0

I have an android application that uses android volley for some php files. I see that other apps on the market restore themselves when I hit clear ram memory. My application loses the volley httpclient and I lose my session for php. What happens to the app when "Clear memory" is called and whan can I do to refresh my app the right way?

I see that the app closes, but when I reopen it from "recent apps panel" it opens on the last activity, but my first activity does the login and creates the session.

I found about session coockies here : Using cookies with Android volley library But I'm wondering what does "clear ram" does.

Community
  • 1
  • 1
  • Who knows what they do? But you should not be using them anyway. Not needed on Android and bad for performance. – Simon Oct 04 '14 at 11:00
  • Take for example, open Facebook app, clear ram then enter again from recent apps, it will load for a second and it will work again. I think it restarts activities. – Georgian Benetatos Oct 04 '14 at 11:02
  • My point was, just don't use "memory cleaners". if someone uses them, it's their problem. They should not be used on Android. – Simon Oct 04 '14 at 11:04
  • I'm talking about the android memory cleaner, the built-in one. People use it often. – Georgian Benetatos Oct 04 '14 at 11:06

1 Answers1

1

Create a base activity from which all your activities inherit. In the base activity's onResume , check for valid session (including valid cookies) , if not valid, reopen the login activity, which will recreate new session/cookie credentials, and update session object.

login and session management needs to apart from your base or regular activity.

ashoke
  • 6,441
  • 2
  • 26
  • 25