Reputation: 301
I have a WebView that loads a certain URL site , I am able to add User Agent String using the following code. I need to set some cookies for the site to enable a mobile view format. Something like the picture below. I want to set the cookies before loading the site, so that on loading it shows up the way I want.
browser.getSettings().setUserAgentString("User Agent stuff");
The examples I found by searching are not straight forward and I couldn't figure it out. I hope I can get some assistance here, I will appreciate it!
Upvotes: 0
Views: 3098
Reputation: 26925
Use the CookieManager
API. Be sure that your input data into the setCookie()
function is in the corresponding format in comparison to those cookies appearing in real web browsers/Wireshark etc.
Upvotes: 1