1

in my application I'm having three activities where first activity is for an intro, 2nd one is login/register and the third one is webView. how can I manage the session between all three activities? when someone login in login activity server will send the JSESSIONID in the cookies. how to use that same JSESSIONID and set it to webView cookies. I'm using volley JsonObjectRequest

1 Answers1

0

How session can be managed in andorid:

One of the way for session management in android is by Cookies. The flow is simple, Whenever the User is successfully logged in then in response of that login API call you will get a Response Header named set-cookie which is the newly generated sessionId by the server. You can save it in SharedPreferences and then on every next API call Headers send that same cookie by the key cookie and the value that have saved in SharedPreferences.

How you can set the cookie to WebView:

In your case you have a WebView that you want to set the Cookie so check this link:

Android WebView Cookie Problem

How you can get and Set the headers in Volley

check this link:

https://github.com/google/volley/issues/37

Muhammad waris
  • 314
  • 1
  • 10