List of usage examples for android.webkit CookieManager removeAllCookie
@Deprecated public abstract void removeAllCookie();
From source file:com.moki.touch.fragments.views.WebContent.java
public void cleanupHistory() { try {// w w w .j av a2 s . c o m if (webView != null) { Log.i(TAG, "clean up history"); webView.clearHistory(); webView.clearFormData(); webView.clearCache(true); webView.clearSslPreferences(); webView.destroy(); if (context != null) { CookieSyncManager.createInstance(context); CookieManager cookieManager = CookieManager.getInstance(); cookieManager.removeAllCookie(); } } } catch (Exception e) { Log.i(TAG, e.getMessage(), e); } }
From source file:com.msted.lensrocket.LensRocketService.java
public void logout(boolean shouldRedirectToLogin) { //Clear values mFriendNames.clear();//from w w w . j a va 2 s. c o m mFriends.clear(); mRockets.clear(); //Clear the cookies so they won't auto login to a provider again CookieSyncManager.createInstance(mContext); CookieManager cookieManager = CookieManager.getInstance(); cookieManager.removeAllCookie(); //Clear the user id and token from the shared preferences SharedPreferences settings = mContext.getSharedPreferences("UserData", 0); SharedPreferences.Editor preferencesEditor = settings.edit(); preferencesEditor.clear(); preferencesEditor.commit(); //Clear settings shared preferences SharedPreferences settingsPrefs = PreferenceManager.getDefaultSharedPreferences(mContext); if (settingsPrefs != null) { preferencesEditor = settingsPrefs.edit(); preferencesEditor.clear(); preferencesEditor.commit(); } mClient.logout(); //Take the user back to the splash screen activity to relogin if requested if (shouldRedirectToLogin) { Intent logoutIntent = new Intent(mContext, SplashScreenActivity.class); logoutIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TASK); mContext.startActivity(logoutIntent); } }
From source file:org.sufficientlysecure.keychain.ui.linked.LinkedIdCreateGithubFragment.java
@Override public void onDestroyView() { super.onDestroyView(); try {/*from w w w . j a va 2 s . co m*/ // cookies are automatically saved, we don't want that CookieManager cookieManager = CookieManager.getInstance(); // noinspection deprecation (replacement is api lvl 21) cookieManager.removeAllCookie(); } catch (Exception e) { // no biggie if this fails } }
From source file:com.example.office.ui.Office365DemoActivity.java
/** * Clears cookies used for AADAL authentication. *///from ww w .jav a2 s.c o m private void clearCookies() { CookieSyncManager.createInstance(getApplicationContext()); CookieManager cookieManager = CookieManager.getInstance(); cookieManager.removeAllCookie(); CookieSyncManager.getInstance().sync(); }
From source file:com.microsoft.services.msa.LiveAuthClient.java
/** * Logs out the given user./* w w w .ja v a2s .com*/ * * Also, this method clears the previously created {@link LiveConnectSession}. * {@link LiveAuthListener#onAuthComplete(LiveStatus, LiveConnectSession, Object)} will be * called on completion. Otherwise, * {@link LiveAuthListener#onAuthError(LiveAuthException, Object)} will be called. * * @param userState arbitrary object that is used to determine the caller of the method. * @param listener called on either completion or error during the logout process. */ public void logout(Object userState, LiveAuthListener listener) { if (listener == null) { listener = NULL_LISTENER; } session.setAccessToken(null); session.setAuthenticationToken(null); session.setRefreshToken(null); session.setScopes(null); session.setTokenType(null); clearRefreshTokenFromPreferences(); CookieSyncManager cookieSyncManager = CookieSyncManager.createInstance(this.applicationContext); CookieManager manager = CookieManager.getInstance(); // clear cookies to force prompt on login if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) manager.removeAllCookies(null); else manager.removeAllCookie(); cookieSyncManager.sync(); listener.onAuthComplete(LiveStatus.UNKNOWN, null, userState); }
From source file:org.nypl.simplified.app.MainSettingsAccountActivity.java
@Override public void onAccountLogoutSuccess() { LOG.debug("onAccountLogoutSuccess"); this.onAccountIsNotLoggedIn(); this.annotationsManager = null; //if current account ?? final SimplifiedCatalogAppServicesType app = Simplified.getCatalogAppServices(); app.getBooks().destroyBookStatusCache(); Simplified.getCatalogAppServices().reloadCatalog(true, this.account); final Resources rr = NullCheck.notNull(this.getResources()); final Context context = this.getApplicationContext(); final CharSequence text = NullCheck.notNull(rr.getString(R.string.settings_logout_succeeded)); final int duration = Toast.LENGTH_SHORT; final TextView bt = NullCheck.notNull(this.barcode_text); final TextView pt = NullCheck.notNull(this.pin_text); UIThread.runOnUIThread(() -> {/* w ww . j a v a 2 s .c o m*/ bt.setVisibility(View.GONE); pt.setVisibility(View.GONE); final Toast toast = Toast.makeText(context, text, duration); toast.show(); finish(); overridePendingTransition(0, 0); startActivity(getIntent()); overridePendingTransition(0, 0); }); // logout clever if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { CookieManager.getInstance().removeAllCookies(null); CookieManager.getInstance().flush(); } else { final CookieSyncManager cookie_sync_manager = CookieSyncManager.createInstance(this); cookie_sync_manager.startSync(); final CookieManager cookie_manager = CookieManager.getInstance(); cookie_manager.removeAllCookie(); cookie_manager.removeSessionCookie(); cookie_sync_manager.stopSync(); cookie_sync_manager.sync(); } }
From source file:com.eTilbudsavis.etasdk.SessionManager.java
private void postSession(final Listener<JSONObject> l) { Map<String, Object> args = new HashMap<String, Object>(); args.put(Param.TOKEN_TTL, TTL);/*from www .j a v a 2 s. c om*/ args.put(Param.API_KEY, mEta.getApiKey()); CookieSyncManager.createInstance(mEta.getContext()); CookieManager cm = CookieManager.getInstance(); String cookieString = cm.getCookie(ETA_COOKIE_DOMAIN); if (cookieString != null) { // No session yet, check cookies for old token String authId = null; String authTime = null; String authHash = null; String[] cookies = cookieString.split(";"); for (String cookie : cookies) { String[] keyValue = cookie.split("="); String key = keyValue[0].trim(); String value = keyValue[1]; if (value.equals("")) { continue; } if (key.equals(COOKIE_AUTH_ID)) { authId = value; } else if (key.equals(COOKIE_AUTH_HASH)) { authHash = value; } else if (key.equals(COOKIE_AUTH_TIME)) { authTime = value; } } // If all three fields are set, then try to migrate if (authId != null && authHash != null && authTime != null) { args.put(Param.V1_AUTH_ID, authId); args.put(Param.V1_AUTH_HASH, authHash); args.put(Param.V1_AUTH_TIME, authTime); } // Clear all cookie data, just to make sure cm.removeAllCookie(); } JsonObjectRequest req = new JsonObjectRequest(Method.POST, Endpoint.SESSIONS, new JSONObject(args), getSessionListener(l)); addRequest(req); }
From source file:com.dish.browser.activity.BrowserActivity.java
@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();/*from www .jav a 2 s .c om*/ CookieManager c = CookieManager.getInstance(); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { c.removeAllCookies(null); } else { CookieSyncManager.createInstance(this); c.removeAllCookie(); } }
From source file:com.codename1.impl.android.AndroidImplementation.java
@Override public void clearNativeCookies() { CookieManager mgr = getCookieManager(); mgr.removeAllCookie(); }