开发者

How do I use the session in WebView in my other stuff (Android)?

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 an开发者_如何学Cy way I can attach the cookies of WebView into everything I do in Android?


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜