Android examples for android.webkit:CookieManager
clear Cookies
import android.content.Context; import android.os.Build; import android.webkit.CookieManager; import android.webkit.CookieSyncManager; import android.webkit.WebViewDatabase; public class Main{ public static void clearCookies(Context context) { if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) { CookieSyncManager.createInstance(context); CookieSyncManager.getInstance().startSync(); }//from w ww .jav a2 s . c o m if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { CookieManager.getInstance().removeAllCookies(null); } else { CookieManager.getInstance().removeAllCookie(); } } }