List of usage examples for android.webkit CookieManager hasCookies
public abstract boolean hasCookies();
From source file:com.zbrown.droidsteal.activities.HijackActivity.java
private void setupCookies() { Log.i(APPLICATION_TAG, "######################## COOKIE SETUP ###############################"); CookieManager manager = CookieManager.getInstance(); Log.i(APPLICATION_TAG, "Cookiemanager has cookies: " + (manager.hasCookies() ? "YES" : "NO")); if (manager.hasCookies()) { manager.removeAllCookie();/* ww w . ja v a 2 s. c o m*/ try { Thread.sleep(3000); } catch (InterruptedException e) { Log.e(APPLICATION_TAG, "Error with Thread.sleep(3000)", e); } Log.i(APPLICATION_TAG, "Cookiemanager has still cookies: " + (manager.hasCookies() ? "YES" : "NO")); } Log.i(APPLICATION_TAG, "######################## COOKIE SETUP START ###############################"); for (CookieWrapper cookieWrapper : authToHijack.getCookies()) { Cookie cookie = cookieWrapper.getCookie(); String cookieString = cookie.getName() + "=" + cookie.getValue() + "; domain=" + cookie.getDomain() + "; Path=" + cookie.getPath(); Log.i(APPLICATION_TAG, "Setting up cookie: " + cookieString); manager.setCookie(cookie.getDomain(), cookieString); } CookieSyncManager.getInstance().sync(); Log.i(APPLICATION_TAG, "######################## COOKIE SETUP DONE ###############################"); }
From source file:de.trier.infsec.koch.droidsheep.activities.HijackActivity.java
private void setupCookies() { Log.i(APPLICATION_TAG, "######################## COOKIE SETUP ###############################"); CookieManager manager = CookieManager.getInstance(); Log.i(APPLICATION_TAG, "Cookiemanager has cookies: " + (manager.hasCookies() ? "YES" : "NO")); if (manager.hasCookies()) { manager.removeAllCookie();/*from w w w . ja va 2s. c o m*/ try { Thread.sleep(3000); } catch (InterruptedException e) { } Log.i(APPLICATION_TAG, "Cookiemanager has still cookies: " + (manager.hasCookies() ? "YES" : "NO")); } Log.i(APPLICATION_TAG, "######################## COOKIE SETUP START ###############################"); for (CookieWrapper cookieWrapper : authToHijack.getCookies()) { Cookie cookie = cookieWrapper.getCookie(); String cookieString = cookie.getName() + "=" + cookie.getValue() + "; domain=" + cookie.getDomain() + "; Path=" + cookie.getPath(); Log.i(APPLICATION_TAG, "Setting up cookie: " + cookieString); manager.setCookie(cookie.getDomain(), cookieString); } CookieSyncManager.getInstance().sync(); Log.i(APPLICATION_TAG, "######################## COOKIE SETUP DONE ###############################"); }