I have an activity that lets you sign in to a page. In the next activity it should display a webpage based on the cookie if the login was successful. The cookie is retrived and I try to put it on the webView with the following code:
Cookie sessionCookie = LoginWebView.cookie;
CookieSyncManager.createInstance(webview.this);
CookieManager cookieManager = CookieManager.getInstance();
if (sessionCookie != null) {
cookieManager.removeSessionCookie();
String cookieString = sessionCookie.getName() + "=" + sessionCookie.getValue() + "; domain=" + sessionCookie.getDomain();
Log.v(TAG, "COOKIE SYNC: " + cookieString);
cookieManager.setCookie(domain, cookieString);
CookieSyncManager.getInstance().sync();
}
webView.setWebViewClient(new MyWebViewClient ());
webView.loadUrl("http://a_page.com/getpageiphone.aspx?p=home");
This is losely based on code from other questions here on StackOverflow, but when I load the web-page it does not seem to work. It seems as there is something very wrong with my code but I can't see where and I'm starting to think I'm doing something very wrong.