当前位置: 首页>>代码示例>>Java>>正文


Java CookieManager.removeAllCookies方法代码示例

本文整理汇总了Java中android.webkit.CookieManager.removeAllCookies方法的典型用法代码示例。如果您正苦于以下问题:Java CookieManager.removeAllCookies方法的具体用法?Java CookieManager.removeAllCookies怎么用?Java CookieManager.removeAllCookies使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.webkit.CookieManager的用法示例。


在下文中一共展示了CookieManager.removeAllCookies方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: clearCookies

import android.webkit.CookieManager; //导入方法依赖的package包/类
@SuppressLint("NewApi")
@SuppressWarnings("deprecation")
public void clearCookies() {
	// TODO Break out web storage deletion into its own option/action
	// TODO clear web storage for all sites that are visited in Incognito mode
	WebStorage storage = WebStorage.getInstance();
	storage.deleteAllData();
	CookieManager c = CookieManager.getInstance();
	if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
		c.removeAllCookies(null);
	} else {
		CookieSyncManager.createInstance(this);
		c.removeAllCookie();
	}
}
 
开发者ID:NewCasino,项目名称:browser,代码行数:16,代码来源:BrowserActivity.java

示例2: removeAllCookiesV21

import android.webkit.CookieManager; //导入方法依赖的package包/类
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
private static void removeAllCookiesV21() {
    final CookieManager cookieManager = CookieManager.getInstance();

    Looper looper = Looper.myLooper();
    boolean prepared = false;
    if (looper == null) {
        Looper.prepare();
        prepared = true;
    }

    // requires a looper
    cookieManager.removeAllCookies(new ValueCallback<Boolean>() {
        @Override
        public void onReceiveValue(Boolean value) {
            Thread thread = new Thread() {
                @Override
                public void run() {
                    // is synchronous, run in background
                    cookieManager.flush();
                }
            };
            thread.start();
        }
    });

    if (prepared) {
        looper = Looper.myLooper();
        if (looper != null) {
            looper.quit();
        }
    }
}
 
开发者ID:fivef,项目名称:add_to_evernote_note,代码行数:34,代码来源:EvernoteUtil.java

示例3: closeApp

import android.webkit.CookieManager; //导入方法依赖的package包/类
public static void closeApp (final Activity activity, WebView webView) {

        sharedPref = PreferenceManager.getDefaultSharedPreferences(activity);
        sharedPref.edit().putString("started", "").apply();
        sharedPref.edit().putInt("closeApp", 1).apply();

        if (sharedPref.getBoolean ("clearCookies", false)){
            CookieManager cookieManager = CookieManager.getInstance();
            cookieManager.removeAllCookies(null);
            cookieManager.flush();
        }

        if (sharedPref.getBoolean ("clearCache", false)){
            webView.clearCache(true);
        }

        if (sharedPref.getBoolean ("clearForm", false)){
            webView.clearFormData();
        }

        if (sharedPref.getBoolean ("history", false)){
            activity.deleteDatabase("history_DB_v01.db");
            webView.clearHistory();
        }

        Handler handler = new Handler();
        handler.postDelayed(new Runnable() {
            @Override
            public void run() {
                activity.finish();
            }
        }, 500);
    }
 
开发者ID:JaeNuguid,项目名称:Kids-Portal-Android,代码行数:34,代码来源:helper_main.java

示例4: clearCookies

import android.webkit.CookieManager; //导入方法依赖的package包/类
public static void clearCookies(@NonNull Context context) {
    CookieManager c = CookieManager.getInstance();
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        c.removeAllCookies(null);
    } else {
        //noinspection deprecation
        CookieSyncManager.createInstance(context);
        //noinspection deprecation
        c.removeAllCookie();
    }
}
 
开发者ID:XndroidDev,项目名称:Xndroid,代码行数:12,代码来源:WebUtils.java


注:本文中的android.webkit.CookieManager.removeAllCookies方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。