From: http://developer.android.com/reference/android/webkit/CookieManager.html
public class
CookieManagerextends Objectjava.lang.Object
↳ android.webkit.CookieManager
Class Overview
Manages the cookies used by an application's WebView instances. Cookies are manipulated according to RFC2109.
SummaryPublic Methods :
synchronized boolean acceptCookie()
Gets whether the application's WebView instances send and accept cookies.boolean acceptThirdPartyCookies(WebView webview)
Gets whether the WebView should allow third party cookies to be set.
static boolean allowFileSchemeCookies()
Gets whether the application's WebView instances send and accept cookies for file scheme URLs.
void flush()
Ensures all cookies currently accessible through the getCookie API are written to persistent storage.
String getCookie(String url)
Gets the cookies for the given URL.
synchronized static CookieManager getInstance()
Gets the singleton CookieManager instance.
synchronized boolean hasCookies()
Gets whether there are stored cookies.
void removeAllCookie()
This method was deprecated in API level 21. Use removeAllCookies(ValueCallback) instead.
void removeAllCookies(ValueCallback<Boolean> callback)
Removes all cookies.
void removeExpiredCookie()
This method was deprecated in API level 21. The WebView handles removing expired cookies automatically.
void removeSessionCookie()
This method was deprecated in API level 21. use removeSessionCookies(ValueCallback) instead.
void removeSessionCookies(ValueCallback<Boolean> callback)
Removes all session cookies, which are cookies without an expiration date.
synchronized void setAcceptCookie(boolean accept)
Sets whether the application's WebView instances should send and accept cookies.
static void setAcceptFileSchemeCookies(boolean accept)
Sets whether the application's WebView instances should send and accept cookies for file scheme URLs.
void setAcceptThirdPartyCookies(WebView webview, boolean accept)
Sets whether the WebView should allow third party cookies to be set.
void setCookie(String url, String value, ValueCallback<Boolean> callback)
Sets a cookie for the given URL.
void setCookie(String url, String value)
Sets a cookie for the given URL.
Protected Methods
Object clone()
Creates and returns a copy of this Object.
[Expand]
Inherited Methods
From class java.lang.Object
本文深入探讨了Android WebView中Cookie管理的相关方法,包括接受Cookie、处理第三方Cookie、文件方案Cookie等,提供了实例代码和详细说明。

563

被折叠的 条评论
为什么被折叠?



