本文整理汇总了Java中android.webkit.CookieManager.removeSessionCookie方法的典型用法代码示例。如果您正苦于以下问题:Java CookieManager.removeSessionCookie方法的具体用法?Java CookieManager.removeSessionCookie怎么用?Java CookieManager.removeSessionCookie使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.webkit.CookieManager
的用法示例。
在下文中一共展示了CookieManager.removeSessionCookie方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setCookie
import android.webkit.CookieManager; //导入方法依赖的package包/类
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();
}
示例2: 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();
}
}
示例3: sendResponseMessage
import android.webkit.CookieManager; //导入方法依赖的package包/类
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();
}
}
示例4: 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;
}
示例5: 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();
}
}
示例6: 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(" ");
}
示例7: 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();
}
示例8: 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();
}
}
示例9: setCookies
import android.webkit.CookieManager; //导入方法依赖的package包/类
/**
* 给webview设置cookie
*
* @param context
* @param url
*/
public static void setCookies(Context context, String url) {
if (!TextUtils.isEmpty(url)) {
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP){
CookieSyncManager.createInstance( context);
}
CookieManager cookieManager = CookieManager.getInstance();
cookieManager.setAcceptCookie(true);
cookieManager.removeSessionCookie();
// 自动注入cookie,这个在使用cookie作为用户校验时有用
cookieManager.setCookie(url, "JSESSIONID=" + QuickUtil.getToken());
CookieSyncManager.getInstance().sync();
}
}
示例10: 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();
}
}
示例11: clearCookies
import android.webkit.CookieManager; //导入方法依赖的package包/类
@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();
}
}
示例12: 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 cookieSyncMngr = CookieSyncManager.createInstance(this);
cookieSyncMngr.startSync();
CookieManager cookieManager= CookieManager.getInstance();
cookieManager.removeAllCookie();
cookieManager.removeSessionCookie();
cookieSyncMngr.stopSync();
cookieSyncMngr.sync();
}
}