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


Java CookieManager.removeAllCookie方法代码示例

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


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

示例1: clearCookies

import android.webkit.CookieManager; //导入方法依赖的package包/类
/**
 * Clear the cookies
 */
@SuppressWarnings("deprecation")
public void clearCookies() {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP_MR1) {
        CookieManager.getInstance().removeAllCookies(null);
        CookieManager.getInstance().flush();
    } else {
        CookieSyncManager cookieSyncMngr = CookieSyncManager.createInstance(getContext());
        cookieSyncMngr.startSync();
        CookieManager cookieManager = CookieManager.getInstance();
        cookieManager.removeAllCookie();
        cookieManager.removeSessionCookie();
        cookieSyncMngr.stopSync();
        cookieSyncMngr.sync();
    }
}
 
开发者ID:vic797,项目名称:prowebview,代码行数:19,代码来源:ProWebView.java

示例2: onCreate

import android.webkit.CookieManager; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    //清除cookie
    CookieSyncManager.createInstance(WebViewActivity.this);
    CookieManager cookieManager = CookieManager.getInstance();
    cookieManager.removeAllCookie();

    setContentView(R.layout.activity_webview);

    mWebView = (WebView) findViewById(R.id.login_webview);

    mIntent = getIntent();
    mUrl = mIntent.getStringExtra("extr_url");

    mProgress = (ProgressBar) findViewById(R.id.login_webview_progress);

    init();
}
 
开发者ID:pre-dem,项目名称:pre-dem-android,代码行数:20,代码来源:WebViewActivity.java

示例3: logout

import android.webkit.CookieManager; //导入方法依赖的package包/类
/**
 * Flushes auth state when a call to logout is made.
 *
 * @param context {@link Context}
 */
public void logout(Context context) {
    this.removeFromSecuredPreferences(context, LI_DEFAULT_SDK_SETTINGS);
    this.removeFromSecuredPreferences(context, LI_AUTH_STATE);
    this.removeFromSecuredPreferences(context, LI_DEVICE_ID);
    this.removeFromSecuredPreferences(context, LI_RECEIVER_DEVICE_ID);
    this.removeFromSecuredPreferences(context, LiCoreSDKConstants.LI_SHARED_PREFERENCES_NAME);
    // For clearing cookies, if the android OS is Lollipop (5.0) and above use new way of using CookieManager else use the deprecate methods for older versions
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP_MR1) {
        Log.d(LiCoreSDKConstants.LI_LOG_TAG, "Using clearCookies code for API >=" + String.valueOf(Build.VERSION_CODES.LOLLIPOP_MR1));
        CookieManager.getInstance().removeAllCookies(null);
        CookieManager.getInstance().flush();
    } else {
        Log.d(LiCoreSDKConstants.LI_LOG_TAG, "Using clearCookies code for API <" + String.valueOf(Build.VERSION_CODES.LOLLIPOP_MR1));
        CookieSyncManager cookieSyncMngr= CookieSyncManager.createInstance(context);
        cookieSyncMngr.startSync();
        CookieManager cookieManager= CookieManager.getInstance();
        cookieManager.removeAllCookie();
        cookieManager.removeSessionCookie();
        cookieSyncMngr.stopSync();
        cookieSyncMngr.sync();
    }
    this.liAuthState = null;
}
 
开发者ID:lithiumtech,项目名称:li-android-sdk-core,代码行数:29,代码来源:LiAuthManager.java

示例4: clearCookies

import android.webkit.CookieManager; //导入方法依赖的package包/类
/**
 * @see <a href="http://stackoverflow.com/questions/28998241/how-to-clear-cookies-and-cache-of-webview-on-android-when-not-in-webview" />
 * @param context
 */
@SuppressWarnings("deprecation")
public static void clearCookies(Context context)
{

    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP_MR1) {
        CookieManager.getInstance().removeAllCookies(null);
        CookieManager.getInstance().flush();
    } else
    {
        CookieSyncManager cookieSyncMngr= CookieSyncManager.createInstance(context);
        cookieSyncMngr.startSync();
        CookieManager cookieManager= CookieManager.getInstance();
        cookieManager.removeAllCookie();
        cookieManager.removeSessionCookie();
        cookieSyncMngr.stopSync();
        cookieSyncMngr.sync();
    }
}
 
开发者ID:TaRGroup,项目名称:CoolApk-Console,代码行数:23,代码来源:Util.java

示例5: collectCookies

import android.webkit.CookieManager; //导入方法依赖的package包/类
@SuppressWarnings("deprecation")
private String[] collectCookies() {
    String cookies = CookieManager.getInstance().getCookie(Endpoints.BASE_URL);

    if (cookies == null || cookies.isEmpty()) {
        return null;
    }
    //See: http://stackoverflow.com/questions/28998241/how-to-clear-cookies-and-cache-of-webview-on-android-when-not-in-webview
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP_MR1) {
        CookieManager.getInstance().removeAllCookies(null);
        CookieManager.getInstance().flush();
    } else {
        CookieSyncManager cookieSyncMngr = CookieSyncManager.createInstance(getActivity().getApplicationContext());
        cookieSyncMngr.startSync();
        CookieManager cookieManager = CookieManager.getInstance();
        cookieManager.removeAllCookie();
        cookieManager.removeSessionCookie();
        cookieSyncMngr.stopSync();
        cookieSyncMngr.sync();
    }

    return cookies.split(" ");
}
 
开发者ID:jam01,项目名称:LittleLight,代码行数:24,代码来源:SignInFragment.java

示例6: clearCookie

import android.webkit.CookieManager; //导入方法依赖的package包/类
@SuppressWarnings("deprecation")
private void clearCookie() {
    CookieSyncManager cookieSyncManager = CookieSyncManager.createInstance(getContext());
    CookieManager cookieManager = CookieManager.getInstance();
    cookieManager.setAcceptCookie(true);
    cookieManager.removeSessionCookie();
    cookieManager.removeAllCookie();
    cookieSyncManager.sync();
}
 
开发者ID:TakWolf,项目名称:CNode-OAuth-Login-Android,代码行数:10,代码来源:CNodeOAuthLoginView.java

示例7: clearCookies

import android.webkit.CookieManager; //导入方法依赖的package包/类
@SuppressWarnings("deprecation")
public void clearCookies(Context context) {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP_MR1) {
        CookieManager.getInstance().removeAllCookies(null);
        CookieManager.getInstance().flush();
    } else {
        CookieSyncManager cookieSyncMngr = CookieSyncManager.createInstance(context);
        cookieSyncMngr.startSync();
        CookieManager cookieManager = CookieManager.getInstance();
        cookieManager.removeAllCookie();
        cookieManager.removeSessionCookie();
        cookieSyncMngr.stopSync();
        cookieSyncMngr.sync();
    }
}
 
开发者ID:mgilangjanuar,项目名称:GoSCELE,代码行数:16,代码来源:BrowserPresenter.java

示例8: onCreate

import android.webkit.CookieManager; //导入方法依赖的package包/类
@SuppressLint("SetJavaScriptEnabled")
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_login);

    WebView webview = (WebView) findViewById(R.id.vkontakteview);
    webview.getSettings().setJavaScriptEnabled(true);
    webview.clearCache(true);

    //Чтобы получать уведомления об окончании загрузки страницы
    webview.setWebViewClient(new VkontakteWebViewClient());

    //otherwise CookieManager will fall with java.lang.IllegalStateException: CookieSyncManager::createInstance() needs to be called before CookieSyncManager::getInstance()
    CookieSyncManager.createInstance(this);

    CookieManager cookieManager = CookieManager.getInstance();
    cookieManager.removeAllCookie();

    String clientId = getIntent().getStringExtra(EXTRA_CLIENT_ID);
    String scope = getIntent().getStringExtra(EXTRA_SCOPE);
    String groupIds = getIntent().getStringExtra(EXTRA_GROUP_IDS);

    String url = Auth.getUrl(clientId, scope, groupIds);
    webview.loadUrl(url);
}
 
开发者ID:PhoenixDevTeam,项目名称:Phoenix-for-VK,代码行数:27,代码来源:LoginActivity.java

示例9: 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

示例10: 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

示例11: clearCookie

import android.webkit.CookieManager; //导入方法依赖的package包/类
public void clearCookie() {

		CookieSyncManager.createInstance(this);
		CookieManager cookieManager = CookieManager.getInstance();

		cookieManager.removeAllCookie();
		CookieSyncManager.getInstance().sync();
	}
 
开发者ID:smartbeng,项目名称:PaoMovie,代码行数:9,代码来源:BaseActivity.java

示例12: deleteCookie

import android.webkit.CookieManager; //导入方法依赖的package包/类
public void deleteCookie() {
    CookieSyncManager.createInstance(this.context).sync();
    CookieManager instance = CookieManager.getInstance();
    instance.setAcceptCookie(true);
    instance.removeAllCookie();
    LemallPlatform.getInstance().setCookieLinkdata("");
    System.gc();
}
 
开发者ID:JackChan1999,项目名称:letv,代码行数:9,代码来源:LogonManager.java

示例13: clearCookies

import android.webkit.CookieManager; //导入方法依赖的package包/类
public void clearCookies() {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP_MR1) {
        CookieManager.getInstance().removeAllCookies(null);
        CookieManager.getInstance().flush();
    } else {
        CookieSyncManager cookieSyncManager =
                CookieSyncManager.createInstance(ExpressApplication.getApplication());
        cookieSyncManager.startSync();
        CookieManager cookieManager = CookieManager.getInstance();
        cookieManager.removeAllCookie();
        cookieManager.removeSessionCookie();
        cookieSyncManager.startSync();
        cookieSyncManager.sync();
    }
}
 
开发者ID:mingdroid,项目名称:tumbviewer,代码行数:16,代码来源:DataManager.java

示例14: onCreate

import android.webkit.CookieManager; //导入方法依赖的package包/类
@SuppressWarnings("deprecation")
@SuppressLint("SetJavaScriptEnabled")
@Override
/**
 * When the dialog is created, we add the webview and load the authorize url.
 */
protected void onCreate(Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);
	
	requestWindowFeature(Window.FEATURE_NO_TITLE);
	
	mProgress = new ProgressDialog(getContext());
	mProgress.requestWindowFeature(Window.FEATURE_NO_TITLE);
	mProgress.setMessage("Loading...");
	
	mLayout = new LinearLayout(getContext());
	mLayout.setOrientation(LinearLayout.VERTICAL);

	mWebView = new WebView(getContext());
	mWebView.setVerticalScrollBarEnabled(false);
	mWebView.setHorizontalScrollBarEnabled(false);
	//mWebView.getSettings().setSupportZoom(false);
	mWebView.setLayoutParams(MATCH);
	mWebView.getSettings().setJavaScriptEnabled(true);

	mWebView.setWebViewClient(new OAuthWebViewClient());
       mWebView.setWebChromeClient(new WebChromeClient());
       
       mWebView.loadUrl(mReq.getLocationUri());
       mLayout.addView(mWebView);
       
       Display display = getWindow().getWindowManager().getDefaultDisplay();
	addContentView(mLayout, new FrameLayout.LayoutParams(display.getWidth() - 20, display.getHeight() - 20));
	CookieSyncManager.createInstance(getContext());
	CookieManager cookieManager = CookieManager.getInstance();
	cookieManager.removeAllCookie();
	
}
 
开发者ID:archos-sa,项目名称:aos-Video,代码行数:39,代码来源:OAuthDialog.java

示例15: clearCookies

import android.webkit.CookieManager; //导入方法依赖的package包/类
public static void clearCookies(Context context) {
    // Edge case: an illegal state exception is thrown if an instance of
    // CookieSyncManager has not be created. CookieSyncManager is normally
    // created by a WebKit view, but this might happen if you start the
    // app, restore saved state, and click logout before running a UI
    // dialog in a WebView -- in which case the app crashes
    @SuppressWarnings("unused")
    CookieSyncManager cookieSyncMngr = CookieSyncManager
            .createInstance(context);
    CookieManager cookieManager = CookieManager.getInstance();
    cookieManager.removeAllCookie();
}
 
开发者ID:Dnet3,项目名称:CustomAndroidOneSheeld,代码行数:13,代码来源:FoursquareUtils.java


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