0

I have gone thorugh no. of posts about shared preferences and web services in android but none of them is explaining about - how to save login credential after successful login to any web service (Mine is based on struts2 framework).

Any suggestion will be much helpful to me ..

M using [AyncTask] mechanism to send login credentials to web service for authentication but don't know how to handle the response and work with sharedPrefrences simultaneously..

  • Working with an HTTP response and shared preferences "siimultaneously" is the same as working with them separately; what's the specific issue? – Dave Newton Feb 22 '15 at 15:56
  • @dave problem is that -- in first step my application authenticate user's login credentials from j2ee web service--> if its successful (checking from http response) then i need to open another activity with logged-in user's detail but at this time i want to store these credentials in sharedpreferences also . In addition , when next time user open my app then he need not to login again. ... I am beginner in Android . :) – Harpreet Sandhu - TheRootCoder Feb 22 '15 at 16:06
  • @HarpreetSandhu-TheCoder How did you handle authentication, may be you need to write the authentication interceptor like [this](http://stackoverflow.com/a/16256030/573032)? – Roman C Feb 22 '15 at 18:12
  • @RomanC i know Interceptor . but here i am not using them because after first successful authentication by web service i want to store authentication data(like token or login credentials) in sharedPreferences .. I want to make my app as GMail etc because these app stores credentials in sharedPreferences and don't ask user to fill username ,password again and again . – Harpreet Sandhu - TheRootCoder Feb 22 '15 at 18:31
  • yes, that's why you need it :) – Roman C Feb 22 '15 at 18:33
  • yeah @RomanC . thnx you got my point :) – Harpreet Sandhu - TheRootCoder Feb 22 '15 at 18:46

0 Answers0