private static void clearCookiesForDomain(Context context, String domain) { // This is to work around a bug where CookieManager may fail to instantiate if CookieSyncManager // has never been created. CookieSyncManager syncManager = CookieSyncManager.createInstance(context); syncManager.sync(); CookieManager cookieManager = CookieManager.getInstance(); String cookies = cookieManager.getCookie(domain); if (cookies == null) { return; } String[] splitCookies = cookies.split(";"); for (String cookie : splitCookies) { String[] cookieParts = cookie.split("="); if (cookieParts.length > 0) { String newCookie = cookieParts[0].trim() + "=;expires=Sat, 1 Jan 2000 00:00:01 UTC;"; cookieManager.setCookie(domain, newCookie); } } cookieManager.removeExpiredCookie(); }
private static void clearCookiesForDomain(Context context, String domain) { // This is to work around a bug where CookieManager may fail to instantiate if // CookieSyncManager has never been created. CookieSyncManager syncManager = CookieSyncManager.createInstance(context); syncManager.sync(); CookieManager cookieManager = CookieManager.getInstance(); String cookies = cookieManager.getCookie(domain); if (cookies == null) { return; } String[] splitCookies = cookies.split(";"); for (String cookie : splitCookies) { String[] cookieParts = cookie.split("="); if (cookieParts.length > 0) { String newCookie = cookieParts[0].trim() + "=;expires=Sat, 1 Jan 2000 00:00:01 UTC;"; cookieManager.setCookie(domain, newCookie); } } cookieManager.removeExpiredCookie(); }
private void setCookie(Context context, String domain, String sessionCookie) { CookieSyncManager.createInstance(context); CookieManager cookieManager = CookieManager.getInstance(); cookieManager.setAcceptCookie(true); if (sessionCookie != null) { // delete old cookies cookieManager.removeSessionCookie(); } try { Thread.sleep(200); } catch (InterruptedException e) { e.printStackTrace(); } cookieManager.setCookie(domain, sessionCookie); CookieSyncManager.createInstance(context); CookieSyncManager.getInstance().sync(); }
public static boolean hasSession() { if (!CookieManager.getInstance().hasCookies()) { return false; } String cookies = CookieManager.getInstance().getCookie("www.lostfilm.tv"); if (cookies != null) { String[] cookieList = cookies.split(";"); for (String cookie : cookieList) { String name = cookie.split("=")[0].trim(); String value = cookie.split("=")[1].trim(); if (name.equals("lf_session")) { return true; } } } return false; }
public static void removeSessionCookies(ValueCallback<Boolean> callback) { if (callback == null) callback = getDefaultIgnoreCallback(); if (CookieManager.getInstance() == null) { callback.onReceiveValue(new Boolean(false)); return; } if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) { CookieManager.getInstance().removeSessionCookie(); toSyncCookies(); callback.onReceiveValue(new Boolean(true)); return; } CookieManager.getInstance().removeSessionCookies(callback); toSyncCookies(); }
/** * 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(); } }
public void reset() { Editor editor = mSharedPref.edit(); editor.putString(ACCESS_TOKEN, ""); editor.putString(USERID, ""); editor.putString(USERNAME, ""); editor.putString(FULLNAME, ""); editor.putString(PROFILPIC, ""); editor.putInt(FOLLOW,0); editor.putInt(FOLLOWED,0); editor.commit(); CookieSyncManager.createInstance(mContext); CookieManager cookieManager = CookieManager.getInstance(); cookieManager.removeAllCookie(); }
private String getExistingCookie() { try { CookieSyncManager.createInstance(context); CookieManager cm = CookieManager.getInstance(); if (cm != null) { String wvcookie = cm.getCookie(Settings.COOKIE_DOMAIN); if (!TextUtils.isEmpty(wvcookie)) { String[] existingCookies = wvcookie.split("; "); for (String cookie : existingCookies) { if (cookie != null && cookie.contains(Settings.AN_UUID)) { return cookie; } } } } } catch (Exception e) { } return null; }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); mSpinner = new ProgressDialog(getContext()); mSpinner.requestWindowFeature(Window.FEATURE_NO_TITLE); mSpinner.setMessage("Loading..."); mContent = new LinearLayout(getContext()); mContent.setOrientation(LinearLayout.VERTICAL); setUpTitle(); setUpWebView(); Display display = getWindow().getWindowManager().getDefaultDisplay(); final float scale = getContext().getResources().getDisplayMetrics().density; float[] dimensions = (display.getWidth() < display.getHeight()) ? DIMENSIONS_PORTRAIT : DIMENSIONS_LANDSCAPE; addContentView(mContent, new FrameLayout.LayoutParams((int) (dimensions[0] * scale + 0.5f), (int) (dimensions[1] * scale + 0.5f))); CookieSyncManager.createInstance(getContext()); CookieManager cookieManager = CookieManager.getInstance(); cookieManager.removeAllCookie(); }
/** * @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(); } }
@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(" "); }
public static void removeSessionCookies(ValueCallback<Boolean> callback) { if (callback == null) callback = getDefaultIgnoreCallback(); if (CookieManager.getInstance() == null) { callback.onReceiveValue(new Boolean(false)); return; } if (!SysUtils.hasLollipop()) { CookieManager.getInstance().removeSessionCookie(); toSyncCookies(); callback.onReceiveValue(new Boolean(true)); return; } else { CookieManager.getInstance().removeSessionCookies(callback); } toSyncCookies(); }
private static void toSyncCookies() { if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) { CookieSyncManager.getInstance().sync(); return; } AsyncTask.THREAD_POOL_EXECUTOR.execute(new Runnable() { @Override public void run() { if (SysUtils.hasLollipop()) CookieManager.getInstance().flush(); } }); }
protected void sendResponseMessage(HttpResponse response) { super.sendResponseMessage(response); Header[] headers = response.getHeaders("Set-Cookie"); if (headers != null && headers.length > 0) { CookieSyncManager.createInstance(this.val$context).sync(); CookieManager instance = CookieManager.getInstance(); instance.setAcceptCookie(true); instance.removeSessionCookie(); String mm = ""; for (Header header : headers) { String[] split = header.toString().split("Set-Cookie:"); EALogger.i("正式登录", "split[1]===>" + split[1]); instance.setCookie(Constants.THIRDLOGIN, split[1]); int index = split[1].indexOf(";"); if (TextUtils.isEmpty(mm)) { mm = split[1].substring(index + 1); EALogger.i("正式登录", "mm===>" + mm); } } EALogger.i("正式登录", "split[1222]===>COOKIE_DEVICE_ID=" + LemallPlatform.getInstance().uuid + ";" + mm); instance.setCookie(Constants.THIRDLOGIN, "COOKIE_DEVICE_ID=" + LemallPlatform.getInstance().uuid + ";" + mm); instance.setCookie(Constants.THIRDLOGIN, "COOKIE_APP_ID=" + LemallPlatform.getInstance().getmAppInfo().getId() + ";" + mm); CookieSyncManager.getInstance().sync(); this.val$iLetvBrideg.reLoadWebUrl(); } }
protected void sendResponseMessage(HttpResponse response) { super.sendResponseMessage(response); Header[] headers = response.getHeaders("Set-Cookie"); if (headers != null && headers.length > 0) { CookieSyncManager.createInstance(LemallPlatform.getInstance().getContext()).sync(); CookieManager instance = CookieManager.getInstance(); instance.setAcceptCookie(true); instance.removeSessionCookie(); String mm = ""; for (Header header : headers) { String[] split = header.toString().split("Set-Cookie:"); EALogger.i("游客登录", "split[1]===>" + split[1]); instance.setCookie(Constants.GUESTLOGIN, split[1]); int index = split[1].indexOf(";"); if (TextUtils.isEmpty(mm)) { mm = split[1].substring(index + 1); EALogger.i("正式登录", "mm===>" + mm); } } EALogger.i("游客登录", "split[11]===>COOKIE_DEVICE_ID=" + LemallPlatform.getInstance().uuid + ";" + mm); instance.setCookie(Constants.GUESTLOGIN, "COOKIE_DEVICE_ID=" + LemallPlatform.getInstance().uuid + ";" + mm); instance.setCookie(Constants.THIRDLOGIN, "COOKIE_APP_ID=" + LemallPlatform.getInstance().getmAppInfo().getId() + ";" + mm); CookieSyncManager.getInstance().sync(); this.val$iLetvBrideg.reLoadWebUrl(); } }
private void initSettings(){ WebSettings webSettings = this.getSettings(); webSettings.setJavaScriptEnabled(true); webSettings.setDomStorageEnabled(true); webSettings.setAllowFileAccess(true); webSettings.setUseWideViewPort(true); webSettings.setUseWideViewPort(true); webSettings.setLoadWithOverviewMode(true); webSettings.setSupportZoom(false); webSettings.setBuiltInZoomControls(false); webSettings.setDisplayZoomControls(false); webSettings.setDefaultTextEncodingName("UTF-8"); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) { webSettings.setAllowFileAccessFromFileURLs(true); webSettings.setAllowUniversalAccessFromFileURLs(true); } if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP){ CookieManager cookieManager = CookieManager.getInstance(); cookieManager.setAcceptThirdPartyCookies(this,true); } setWebViewDefaultCacheMode(); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { webSettings.setMixedContentMode( WebSettings.MIXED_CONTENT_COMPATIBILITY_MODE); } setCachePath(); }
public static String getCookieFromAppCookieManager(String url) throws MalformedURLException { CookieManager cookieManager = CookieManager.getInstance(); if (cookieManager == null) return null; // 出錯點 1 cookieManager.setAcceptCookie(true); String rawCookieHeader = null; URL parsedURL = new URL(url); // 出錯點 2 // Extract Set-Cookie header value from Android app CookieManager for this URL rawCookieHeader = cookieManager.getCookie(parsedURL.getHost()); if (rawCookieHeader == null) return null; return rawCookieHeader; }
public void onPageFinished(WebView view, String url) { super.onPageFinished(view, url); // CB-10395 InAppBrowser's WebView not storing cookies reliable to local device storage if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.LOLLIPOP) { CookieManager.getInstance().flush(); } else { CookieSyncManager.getInstance().sync(); } // https://issues.apache.org/jira/browse/CB-11248 view.clearFocus(); view.requestFocus(); try { JSONObject obj = new JSONObject(); obj.put("type", LOAD_STOP_EVENT); obj.put("url", url); sendUpdate(obj, true); } catch (JSONException ex) { LOG.d(LOG_TAG, "Should never happen"); } }
@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(); }
@Override public void onPageFinished(WebView view, String url) { super.onPageFinished(view, url); String cookies = CookieManager.getInstance().getCookie(url); Log.d(mTag, "All the cookies in a string:" + cookies); if (!TextUtils.isEmpty(cookies) && cookies.contains("clearance")) { if (mParser.isCloudFlareDDOSEnabled) { mParser.isCloudFlareDDOSPassed = true; mParser.mCustomUserAgent = view.getSettings().getUserAgentString(); mParser.mCookies = cookies; parseData(mAnimeUrl); } } else { parseData(mAnimeUrl); } }
@Override public void onReceive(Context context, Intent intent) { if (intent.getAction().equals(BROADCAST_ACTION_LOAD_URL)) { final String url = intent.getStringExtra(BROADCAST_ACTION_LOAD_URL); mWebView.loadUrl(url); } if (intent.getAction().equals(BROADCAST_ACTION_JS_EXEC)) { final String js = intent.getStringExtra(BROADCAST_ACTION_JS_EXEC); Log.d(TAG, "Executing javascript in current browser: " +js); mWebView.evaluateJavascript(js,null); } if (intent.getAction().equals(BROADCAST_ACTION_CLEAR_BROWSER_CACHE)) { mWebView.clearCache(true); CookieManager.getInstance().removeAllCookies(null); Log.i(TAG, "Browser cache cleared."); } if (intent.getAction().equals(BROADCAST_ACTION_SCREEN_ON)) { screenOn(); } }
/** * 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; }
public void onPageFinished(WebView view, String url) { super.onPageFinished(view, url); // CB-10395 InAppBrowser's WebView not storing cookies reliable to local device storage if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.LOLLIPOP) { CookieManager.getInstance().flush(); } else { CookieSyncManager.getInstance().sync(); } try { JSONObject obj = new JSONObject(); obj.put("type", LOAD_STOP_EVENT); obj.put("url", url); sendUpdate(obj, true); } catch (JSONException ex) { LOG.d(LOG_TAG, "Should never happen"); } }
@TargetApi(Build.VERSION_CODES.LOLLIPOP) public SystemCookieManager(WebView webview) { webView = webview; cookieManager = CookieManager.getInstance(); //REALLY? Nobody has seen this UNTIL NOW? cookieManager.setAcceptFileSchemeCookies(true); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { cookieManager.setAcceptThirdPartyCookies(webView, true); } }
@SuppressWarnings("deprecation") private void clearCookie() { CookieSyncManager cookieSyncManager = CookieSyncManager.createInstance(getContext()); CookieManager cookieManager = CookieManager.getInstance(); cookieManager.setAcceptCookie(true); cookieManager.removeSessionCookie(); cookieManager.removeAllCookie(); cookieSyncManager.sync(); }
public void saveUserSessionId(String userSessionId){ // save to cookie manager CookieManager cookieManager = CookieManager.getInstance(); cookieManager.setCookie(CMBCHINA_BASIC_URL, "userSessionId=" +userSessionId); CookieSyncManager.getInstance().sync(); // save to sharedpreference SharedPreferenceHelper.getInstance(getApplicationContext()).saveString(CMBCHINA_SHARED_PERFERENCE_KEY_USER_SESSION_ID,userSessionId); }
@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(); } }
@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(); } }
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); }
@Override public void onCreate(Bundle icicle) { super.onCreate(icicle); // Make sure that expired cookies are removed on launch. CookieSyncManager.createInstance(this); CookieManager.getInstance().removeExpiredCookie(); Intent intent = getIntent(); if (intent == null || !intent.getAction().equals(Intents.SearchBookContents.ACTION)) { finish(); return; } isbn = intent.getStringExtra(Intents.SearchBookContents.ISBN); if (LocaleManager.isBookSearchUrl(isbn)) { setTitle(getString(R.string.sbc_name)); } else { setTitle(getString(R.string.sbc_name) + ": ISBN " + isbn); } setContentView(R.layout.search_book_contents); queryTextView = (EditText) findViewById(R.id.query_text_view); String initialQuery = intent.getStringExtra(Intents.SearchBookContents.QUERY); if (initialQuery != null && !initialQuery.isEmpty()) { // Populate the search box but don't trigger the search queryTextView.setText(initialQuery); } queryTextView.setOnKeyListener(keyListener); queryButton = findViewById(R.id.query_button); queryButton.setOnClickListener(buttonListener); resultListView = (ListView) findViewById(R.id.result_list_view); LayoutInflater factory = LayoutInflater.from(this); headerView = (TextView) factory.inflate(R.layout.search_book_contents_header, resultListView, false); resultListView.addHeaderView(headerView); }
private void handleThrowException(Directive directive) { Payload payload = directive.getPayload(); if (payload instanceof ThrowExceptionPayload) { ThrowExceptionPayload throwExceptionPayload = (ThrowExceptionPayload) payload; if (throwExceptionPayload.getCode() == ThrowExceptionPayload.Code.UNAUTHORIZED_REQUEST_EXCEPTION) { // 分别清空token 和 cookie OauthPreferenceUtil.clearAllOauth(DcsSampleApplication.getInstance()); HttpConfig.setAccessToken(""); CookieSyncManager.createInstance(DcsSampleApplication.getInstance()); CookieManager.getInstance().removeAllCookie(); } fireThrowException(throwExceptionPayload); } }
@NonNull @Override public Completable updateCookiePreference() { return Completable.create(new CompletableAction() { @Override public void onSubscribe(@NonNull CompletableSubscriber subscriber) { CookieManager cookieManager = CookieManager.getInstance(); if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) { CookieSyncManager.createInstance(IncognitoActivity.this); } cookieManager.setAcceptCookie(mPreferences.getIncognitoCookiesEnabled()); subscriber.onComplete(); } }); }
@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); }
@Override public boolean setCookie(String url, List<String> cookies) { if (!TextUtils.isEmpty(url) && cookies != null && cookies.size() > 0) { CookieManager cookieManager = CookieManager.getInstance(); for (String cookie : cookies) { cookieManager.setCookie(url, cookie); } return true; } return false; }
public static void removeExpiredCookies() { CookieManager mCookieManager = null; if ((mCookieManager = CookieManager.getInstance()) != null) { //同步清除 mCookieManager.removeExpiredCookie(); toSyncCookies(); } }
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(); } }