user1571861
user1571861

Reputation: 13

Cookies in WebView Android

I can't read all my cookies, in my webview i can only read "PHP_AUTH_SID" named cookie, but in browser i can see all cookies. Here is my code:

super.onCreate(savedInstanceState);
CookieSyncManager.createInstance(this);
webView = (WebView) findViewById(R.id.web_login);

And this is my shouldOverrideUrlLoading() method in web view client

CookieSyncManager.getInstance().sync();
final CookieManager cookiesManager = CookieManager.getInstance();
cookiesManager.setAcceptCookie(true);
final String cookies = cookiesManager.getCookie(COOKIES_HOST);
Log.i("123123", cookies);

in LogCat i can see only: "09-13 14:05:48.139: I/123123(21188):PHP_AUTH_SID=..."

in browser:

PHP_AUTH_SID=...,
access_token=...

Upvotes: 0

Views: 1935

Answers (1)

sk2212
sk2212

Reputation: 1722

It seems that the output from LogCat is just cut off. Just try to debug and see the "really" content of "cookies" string.

I think you could just parse the cookies string with String[] elements = cookies.split("=")

Upvotes: 3

Related Questions