當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。