views:

61

answers:

1

I have a username as password which I need to send to a website as part of an android application (yes it is https), and once submitted to the seerver via POST, the server should return cookies. I need to be able to capture these cookies, and allow them to be accessed in a webview which I have settup.

How would I do this?

Thanks

+1  A: 

You can call the setCookie function on the CookieManager instance, which you can get by calling a static method on it named getInstance.

Maz
How would I go about retrieving the response from the server?
Steven1350
Oh, I misunderstood your question: actually, the easiest thing is probably to make the webview submit the form itself. Create a webview, then enable javascript in it. Then load HTML code with a form tag with the proper fields (already filled out) pointing to the proper url. Then rig a javascript onload handler to submit the form. The webview can automatically handle the storage of cookies.
Maz
That seems simple enough, but I need it to be fully automated, and the user unaware of the process. Is there a way to do this in the backhground
Steven1350
Just make the WebView hidden.
Maz