Code example for CookieManager

0
  } 
   
  @Provides 
  @Singleton 
  public CookieManager getCookieManager(android.webkit.CookieManager webkitCookieManager){
    CookieManager cookieManager = new CookieManager(new NetCookieStore(webkitCookieManager), null);
    CookieHandler.setDefault(cookieManager);
    return (CookieManager) CookieHandler.getDefault();
  } 
   
  @Provides 
  @Singleton 
  public java.net.CookieStore getNetCookieStore(CookieManager cookieManager){
    return cookieManager.getCookieStore();
  } 
   
  @Provides 
  @Singleton 
  //While CookieSyncManager is not used in this method it's correct initialization is needed by anything that uses android.webkit.CookieManager 
  public android.webkit.CookieManager getWebViewCookieManager(CookieSyncManager cookieSyncManager){
    return android.webkit.CookieManager.getInstance();