Methods Summary |
---|
public abstract boolean | acceptCookie()Gets whether the application's {@link WebView} instances send and accept
cookies.
|
public abstract boolean | acceptThirdPartyCookies(WebView webview)Gets whether the {@link WebView} should allow third party cookies to be set.
|
public static boolean | allowFileSchemeCookies()Gets whether the application's {@link WebView} instances send and accept
cookies for file scheme URLs.
return getInstance().allowFileSchemeCookiesImpl();
|
protected abstract boolean | allowFileSchemeCookiesImpl()Implements {@link #allowFileSchemeCookies()}.
|
protected java.lang.Object | clone()
throw new CloneNotSupportedException("doesn't implement Cloneable");
|
public abstract void | flush()Ensures all cookies currently accessible through the getCookie API are
written to persistent storage.
This call will block the caller until it is done and may perform I/O.
|
public abstract java.lang.String | getCookie(java.lang.String url, boolean privateBrowsing)See {@link #getCookie(String)}.
|
public synchronized java.lang.String | getCookie(android.net.WebAddress uri)Gets cookie(s) for a given uri so that it can be set to "cookie:" in http
request header.
return getCookie(uri.toString());
|
public abstract java.lang.String | getCookie(java.lang.String url)Gets the cookies for the given URL.
|
public static synchronized android.webkit.CookieManager | getInstance()Gets the singleton CookieManager instance. If this method is used
before the application instantiates a {@link WebView} instance,
{@link CookieSyncManager#createInstance CookieSyncManager.createInstance(Context)}
must be called first.
return WebViewFactory.getProvider().getCookieManager();
|
public abstract boolean | hasCookies()Gets whether there are stored cookies.
|
public abstract boolean | hasCookies(boolean privateBrowsing)See {@link #hasCookies()}.
|
public abstract void | removeAllCookie()Removes all cookies.
|
public abstract void | removeAllCookies(ValueCallback callback)Removes all cookies.
This method is asynchronous.
If a {@link ValueCallback} is provided,
{@link ValueCallback#onReceiveValue(T) onReceiveValue()} will be called on the current
thread's {@link android.os.Looper} once the operation is complete.
The value provided to the callback indicates whether any cookies were removed.
You can pass {@code null} as the callback if you don't need to know when the operation
completes or whether any cookies were removed, and in this case it is safe to call the
method from a thread without a Looper.
|
public abstract void | removeExpiredCookie()Removes all expired cookies.
|
public abstract void | removeSessionCookie()Removes all session cookies, which are cookies without an expiration
date.
|
public abstract void | removeSessionCookies(ValueCallback callback)Removes all session cookies, which are cookies without an expiration
date.
This method is asynchronous.
If a {@link ValueCallback} is provided,
{@link ValueCallback#onReceiveValue(T) onReceiveValue()} will be called on the current
thread's {@link android.os.Looper} once the operation is complete.
The value provided to the callback indicates whether any cookies were removed.
You can pass {@code null} as the callback if you don't need to know when the operation
completes or whether any cookie were removed, and in this case it is safe to call the
method from a thread without a Looper.
|
public abstract void | setAcceptCookie(boolean accept)Sets whether the application's {@link WebView} instances should send and
accept cookies.
By default this is set to true and the WebView accepts cookies.
When this is true
{@link CookieManager#setAcceptThirdPartyCookies setAcceptThirdPartyCookies} and
{@link CookieManager#setAcceptFileSchemeCookies setAcceptFileSchemeCookies}
can be used to control the policy for those specific types of cookie.
|
public static void | setAcceptFileSchemeCookies(boolean accept)Sets whether the application's {@link WebView} instances should send and
accept cookies for file scheme URLs.
Use of cookies with file scheme URLs is potentially insecure and turned
off by default.
Do not use this feature unless you can be sure that no unintentional
sharing of cookie data can take place.
Note that calls to this method will have no effect if made after a
{@link WebView} or CookieManager instance has been created.
getInstance().setAcceptFileSchemeCookiesImpl(accept);
|
protected abstract void | setAcceptFileSchemeCookiesImpl(boolean accept)Implements {@link #setAcceptFileSchemeCookies(boolean)}.
|
public abstract void | setAcceptThirdPartyCookies(WebView webview, boolean accept)Sets whether the {@link WebView} should allow third party cookies to be set.
Allowing third party cookies is a per WebView policy and can be set
differently on different WebView instances.
Apps that target {@link android.os.Build.VERSION_CODES#KITKAT} or below
default to allowing third party cookies. Apps targeting
{@link android.os.Build.VERSION_CODES#LOLLIPOP} or later default to disallowing
third party cookies.
|
public abstract void | setCookie(java.lang.String url, java.lang.String value)Sets a cookie for the given URL. Any existing cookie with the same host,
path and name will be replaced with the new cookie. The cookie being set
will be ignored if it is expired.
|
public abstract void | setCookie(java.lang.String url, java.lang.String value, ValueCallback callback)Sets a cookie for the given URL. Any existing cookie with the same host,
path and name will be replaced with the new cookie. The cookie being set
will be ignored if it is expired.
This method is asynchronous.
If a {@link ValueCallback} is provided,
{@link ValueCallback#onReceiveValue(T) onReceiveValue()} will be called on the current
thread's {@link android.os.Looper} once the operation is complete.
The value provided to the callback indicates whether the cookie was set successfully.
You can pass {@code null} as the callback if you don't need to know when the operation
completes or whether it succeeded, and in this case it is safe to call the method from a
thread without a Looper.
|