• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Apps webview + cookies

tneva82

Newbie
Okay I'm trying to get webview working so that when user presses button from application it would go to login page with username+password in POST. This works almost correctly but cookies don't work which screws part of the page's operation. Here's the code:

Code:
String postData = "u="+username+"&p="+passwd;
         WebView webview=(WebView)findViewById(R.id.myWebView);
         
         CookieManager cookieManager = CookieManager.getInstance();                              
         CookieSyncManager.createInstance(this);
         CookieSyncManager.getInstance().startSync();
         cookieManager.setAcceptCookie(true); 
         webview.getSettings().setJavaScriptEnabled(true);

         webview.postUrl(website, EncodingUtils.getBytes(postData, "BASE64"));

What am I missing? Works fine if I use reqular browser to log in and then go to application and press the button so I know it SHOULD be doable but guess I'm missing step(or two) here.
 
Back
Top Bottom