Android CookieManager

I have an application that makes several web calls to authenticate, after which JSON returns. My web calls are from an https server and I am using HTTPURlConnection.

I need to save the session in a cookie, after exploring around this I found this

http://developer.android.com/reference/java/net/HttpURLConnection.html

In sessions with a cookie header, it tells you to use this code here

   CookieManager cookieManager = new CookieManager();
   CookieHandler.setDefault(cookieManager);

However, when I try to use this code, the new CookieManager (); the part is highlighted in red and says

CookieManager constructor not showing

and Cookiehandler.setDefault is also highlighted in red and says

The setDefault (CookieHandler) method in the CookieHandler type is not applicable for arguments (CookieManager)

Does anyone know why this is?

Thanks in advance!

+5
1

, CookieManager. Android 2 ...

android.webkit.CookieManager
java.net.CookieManager

java.net.CookieManager.

+10

All Articles