Android examples for android.webkit:CookieManager
sync Cookie With System Browser
import android.annotation.SuppressLint; import android.content.Context; import android.os.Build; import android.webkit.CookieManager; import android.webkit.CookieSyncManager; import android.webkit.WebView; public class Main{ /**/*from w ww. j ava2s .com*/ * Sync cookie with system browser. * * @param context * the context */ public static void syncCookieWithSystemBrowser(Context context) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { CookieManager.getInstance().flush(); } else { CookieSyncManager.createInstance(context); CookieSyncManager.getInstance().startSync(); CookieSyncManager.getInstance().sync(); } } }