List of usage examples for android.webkit CookieManager removeAllCookie
@Deprecated public abstract void removeAllCookie();
From source file:com.social_api.facebook.core.Util.java
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 hasStarted 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(); }
From source file:org.catrobat.catroid.ui.WebViewActivity.java
@SuppressWarnings("deprecated") @SuppressLint("NewApi") public static void clearCookies(Context context) { if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.LOLLIPOP_MR1) { CookieSyncManager cookieSyncMngr = CookieSyncManager.createInstance(context); cookieSyncMngr.startSync();/*from w w w .j a v a2 s . c o m*/ CookieManager cookieManager = CookieManager.getInstance(); cookieManager.removeAllCookie(); cookieManager.removeSessionCookie(); cookieSyncMngr.stopSync(); cookieSyncMngr.sync(); } else { CookieManager.getInstance().removeAllCookies(null); CookieManager.getInstance().flush(); } }
From source file:com.iStudy.Study.Renren.Util.java
public static void clearCookies(Context context) { @SuppressWarnings("unused") CookieSyncManager cookieSyncMngr = CookieSyncManager.createInstance(context); CookieManager cookieManager = CookieManager.getInstance(); cookieManager.removeAllCookie(); }
From source file:com.zake.Weibo.net.Utility.java
/** * Clear current context cookies .// ww w . j a va2 s .c o m * * @param context * : current activity context. * * @return void */ public static void clearCookies(Context context) { @SuppressWarnings("unused") CookieSyncManager cookieSyncMngr = CookieSyncManager.createInstance(context); CookieManager cookieManager = CookieManager.getInstance(); cookieManager.removeAllCookie(); }
From source file:com.dongfang.dicos.sina.UtilSina.java
/** * Clear current context cookies .//from w w w .ja v a 2s .c o m * * @param context * : current activity context. * * @return void */ public static void clearCookies(Context context) { @SuppressWarnings("unused") CookieSyncManager cookieSyncMngr = CookieSyncManager.createInstance(context); CookieManager cookieManager = CookieManager.getInstance(); cookieManager.removeAllCookie(); }
From source file:stack.com.stackapi.ui.StackBaseActivity.java
public void clearCookies() { CookieSyncManager.createInstance(this); CookieManager cookieManager = CookieManager.getInstance(); cookieManager.removeAllCookie(); }
From source file:com.kinsights.cookies.Cookies.java
public void clear() { CookieManager cookieManager = CookieManager.getInstance(); cookieManager.removeExpiredCookie(); cookieManager.removeSessionCookie(); cookieManager.removeAllCookie(); }
From source file:org.forgerock.openam.mobile.example.oauth2.activities.webview.AuthorizeWebClient.java
/** * Configures the client with the token needed to authenticate to the server * * @param resource The openam server information *///w w w. ja v a2 s .co m private void configureClient(OpenAMServerResource resource) { CookieManager cookieManager = CookieManager.getInstance(); cookieManager.removeAllCookie(); if (tokenId != null) { String cookieName = authNClient.getCookieNameWithDefault(AppConstants.DEFAULT_COOKIE_NAME); String domain = authNClient.getCookieDomainWithDefault(Uri.parse(resource.getOpenAmBase()).getHost()); String url = authNClient.getOpenAmServerResource().getWebLoginUrl(); insertCookie(cookieName, tokenId, domain, url); } }
From source file:org.dmfs.oauth2.android.fragment.InteractiveGrantFragment.java
@SuppressLint("SetJavaScriptEnabled") @Nullable// w w w . j ava 2 s .c o m @Override public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { if (mWebView == null) { // create and configure the WebView // Note using just getActivity would will leak the activity. mWebView = new WebView(getActivity().getApplicationContext()); mWebView.setLayoutParams(new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)); mWebView.getSettings().setJavaScriptEnabled(true); mWebView.setOnKeyListener(this); mWebView.setWebViewClient(mGrantWebViewClient); mWebView.loadUrl(mGrant.authorizationUrl().toASCIIString()); // wipe cookies to enforce a new login if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP_MR1) { CookieManager.getInstance().removeAllCookies(null); CookieManager.getInstance().flush(); } else { CookieSyncManager cookieSyncMngr = CookieSyncManager.createInstance(getActivity()); cookieSyncMngr.startSync(); CookieManager cookieManager = CookieManager.getInstance(); cookieManager.removeAllCookie(); cookieManager.removeSessionCookie(); cookieSyncMngr.stopSync(); cookieSyncMngr.sync(); } } return mWebView; }
From source file:com.hua.nowid.activity.WebViewFragment.java
public void updateSecureCookie() { CookieSyncManager.createInstance(this.getActivity().getApplicationContext()); CookieManager cookieManager = CookieManager.getInstance(); String cookieString = "NOWSESSIONID=" + NowIDLoginStatus.getInstance().getSecureCookie(); cookieManager.removeAllCookie(); cookieManager.setCookie(".now.com", cookieString); Log.v("WebViewFragment", cookieString); CookieSyncManager.getInstance().sync(); }