共用方式為


CookieSyncManager Class

Definition

Caution

This class is obsoleted in this android platform

The CookieSyncManager is used to synchronize the browser cookie store between RAM and permanent storage.

[Android.Runtime.Register("android/webkit/CookieSyncManager", DoNotGenerateAcw=true)]
[System.Obsolete("This class is obsoleted in this android platform")]
public sealed class CookieSyncManager : Android.Webkit.WebSyncManager, IDisposable, Java.Interop.IJavaPeerable
[<Android.Runtime.Register("android/webkit/CookieSyncManager", DoNotGenerateAcw=true)>]
[<System.Obsolete("This class is obsoleted in this android platform")>]
type CookieSyncManager = class
    inherit WebSyncManager
    interface IRunnable
    interface IJavaObject
    interface IDisposable
    interface IJavaPeerable
Inheritance
CookieSyncManager
Attributes
Implements

Remarks

The CookieSyncManager is used to synchronize the browser cookie store between RAM and permanent storage. To get the best performance, browser cookies are saved in RAM. A separate thread saves the cookies between, driven by a timer.

To use the CookieSyncManager, the host application has to call the following when the application starts:

CookieSyncManager.createInstance(context)

To set up for sync, the host application has to call

CookieSyncManager.getInstance().startSync()

in Activity.onResume(), and call

CookieSyncManager.getInstance().stopSync()

in Activity.onPause().

To get instant sync instead of waiting for the timer to trigger, the host can call

CookieSyncManager.getInstance().sync()

The sync interval is 5 minutes, so you will want to force syncs manually anyway, for instance in WebViewClient#onPageFinished. Note that even sync() happens asynchronously, so don't do it just as your activity is shutting down.

This member is deprecated. The WebView now automatically syncs cookies as necessary. You no longer need to create or use the CookieSyncManager. To manually force a sync you can use the CookieManager method CookieManager#flush which is a synchronous replacement for #sync.

Java documentation for android.webkit.CookieSyncManager.

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Fields

Logtag (Inherited from WebSyncManager)

Properties

Class

Returns the runtime class of this Object.

(Inherited from Object)
Handle

The handle to the underlying Android instance.

(Inherited from Object)
Instance
Obsolete.

Singleton access to a CookieSyncManager.

JniIdentityHashCode (Inherited from Object)
JniPeerMembers
MDataBase (Inherited from WebSyncManager)
MHandler (Inherited from WebSyncManager)
PeerReference (Inherited from Object)
ThresholdClass (Inherited from WebSyncManager)
ThresholdType (Inherited from WebSyncManager)

Methods

Clone()

Creates and returns a copy of this object.

(Inherited from Object)
CreateInstance(Context)
Obsolete.

Create a singleton CookieSyncManager within a context

Dispose() (Inherited from Object)
Dispose(Boolean) (Inherited from Object)
Equals(Object)

Indicates whether some other object is "equal to" this one.

(Inherited from Object)
GetHashCode()

Returns a hash code value for the object.

(Inherited from Object)
JavaFinalize()

Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.

(Inherited from Object)
Notify()

Wakes up a single thread that is waiting on this object's monitor.

(Inherited from Object)
NotifyAll()

Wakes up all threads that are waiting on this object's monitor.

(Inherited from Object)
OnSyncInit() (Inherited from WebSyncManager)
ResetSync()
Obsolete.

resetSync() resets sync manager's timer.

Run()
Obsolete.

Starts executing the active part of the class' code.

SetHandle(IntPtr, JniHandleOwnership)

Sets the Handle property.

(Inherited from Object)
StartSync()
Obsolete.

startSync() requests sync manager to start sync.

StopSync()
Obsolete.

stopSync() requests sync manager to stop sync.

Sync()
Obsolete.

sync() forces sync manager to sync now

ToArray<T>() (Inherited from Object)
ToString()

Returns a string representation of the object.

(Inherited from Object)
UnregisterFromRuntime() (Inherited from Object)
Wait()

Causes the current thread to wait until it is awakened, typically by being <em>notified</em> or <em>interrupted</em>.

(Inherited from Object)
Wait(Int64, Int32)

Causes the current thread to wait until it is awakened, typically by being <em>notified</em> or <em>interrupted</em>, or until a certain amount of real time has elapsed.

(Inherited from Object)
Wait(Int64)

Causes the current thread to wait until it is awakened, typically by being <em>notified</em> or <em>interrupted</em>, or until a certain amount of real time has elapsed.

(Inherited from Object)

Explicit Interface Implementations

IJavaPeerable.Disposed() (Inherited from Object)
IJavaPeerable.DisposeUnlessReferenced() (Inherited from Object)
IJavaPeerable.Finalized() (Inherited from Object)
IJavaPeerable.JniManagedPeerState (Inherited from Object)
IJavaPeerable.SetJniIdentityHashCode(Int32) (Inherited from Object)
IJavaPeerable.SetJniManagedPeerState(JniManagedPeerStates) (Inherited from Object)
IJavaPeerable.SetPeerReference(JniObjectReference) (Inherited from Object)

Extension Methods

JavaCast<TResult>(IJavaObject)

Performs an Android runtime-checked type conversion.

JavaCast<TResult>(IJavaObject)
GetJniTypeName(IJavaPeerable)

Applies to