views:

259

answers:

1

The user must login through the WebView. Of course, the session is for that WebView. But, what if I need to make REST API calls during my Android application?

Those REST API calls need the session to be authenticated , otherwise those will not work. Is there any way I can attach the cookies of WebView into everything I do in Android?

A: 

But, what if I need to make REST API calls during my Android application?

It is possible you can use CookieManager.getInstance() to get access to the cookie in your WebView, then add it to the HttpClient CookieStore. So long as you keep using that same instance of the HttpClient object, it will continue to use that same CookieStore and will use the cookie. However, if that cookie changes via WebView, you will need to go get it again. I have not tried this and do not know what problems you may encounter.

CommonsWare