Skip to content

Instantly share code, notes, and snippets.

@aaronpearce
Created June 7, 2012 06:56
Show Gist options
  • Save aaronpearce/2887031 to your computer and use it in GitHub Desktop.
Save aaronpearce/2887031 to your computer and use it in GitHub Desktop.
CookieSyncManager.createInstance(getApplicationContext());
CookieManager mgr = CookieManager.getInstance();
List<Cookie> cookies = ((AbstractHttpClient) httpClient).getCookieStore().getCookies();
if(cookies != null)
{
for(Cookie cookie : cookies)
{
String cookieString = cookie.getName() + "=" + cookie.getValue() + "; domain=" + cookie.getDomain();
mgr.setCookie(cookie.getDomain(), cookieString);
}
}
CookieSyncManager.getInstance().sync();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment