I have some problem entering my cookie on the login.php page. This is the code:
LinearLayout lLayout = (LinearLayout)findViewById(R.id.linearlayoutIdLogin);
lLayout.setVisibility(View.GONE); //make my standard layout inivisible
LinearLayout lWeb = (LinearLayout)findViewById(R.id.webviewId);
lWeb.setVisibility(View.VISIBLE); //make my webview visible
WebView browse = (WebView)findViewById(R.id.webViewBrowse);
The correct code. I loaded my WebView, but then the page says that I need to log in.
This is an injection of cookies that does not work for me.
Cookie setcookie = cookie.get(1);
Cookie othercookie = cookie.get(0);
CookieManager cookieManager = CookieManager.getInstance();
cookieManager.setAcceptCookie(true);
cookieManager.setCookie("http://www.thedomain.com", setcookie.getValue());
browse.setWebViewClient(new WebViewClient(){ });
browse.loadUrl("mypagewhenloggedin.php");
Any ideas? Stuck on this for several hours. Thanks in advance!
Edited Code: Forgot to say that I added this cookie too.
cookieManager.setCookie("http://www.thedomain.com", othercookie.getValue());
source
share