3

I have a webview which loads the given URL (say google.com). I log in Google but after closing the WebView activity and restarting a new one, I assumed I will have to log in again, but I didn't. I have not yet set my Cookies, using CookieManager. I am assuming, WebView stores some cookies by default.

So my question is, how can I test that my webView.loadURL with given cookies works properly?

user2453055
  • 975
  • 1
  • 9
  • 19

1 Answers1

6

Check:

@Override
public void onPageFinished(WebView view, String url){
    String cookies = CookieManager.getInstance().getCookie(url);
    Log.d(TAG, "Eat a cookie:" + cookies);
}

Credits

Community
  • 1
  • 1
Skynet
  • 7,820
  • 5
  • 44
  • 80