Android Guides | Samples

Android.Webkit.CookieSyncManager Class

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

See Also: CookieSyncManager

Syntax

[Android.Runtime.Register("android/webkit/CookieSyncManager", DoNotGenerateAcw=true)]
[System.Obsolete("This class is obsoleted in this android platform")]
public sealed class CookieSyncManager : WebSyncManager

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:

java Example

CookieSyncManager.createInstance(context)

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

java Example

CookieSyncManager.getInstance().startSync()

in Activity.onResume(), and call

java Example

 CookieSyncManager.getInstance().stopSync()

in Activity.onPause().

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

java Example

CookieSyncManager.getInstance().sync()

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

[Android Documentation]

Requirements

Namespace: Android.Webkit
Assembly: Mono.Android (in Mono.Android.dll)
Assembly Versions: 0.0.0.0
Since: Added in API level 1

The members of Android.Webkit.CookieSyncManager are listed below.

See Also: WebSyncManager

Protected Fields

const
LogtagString.

Public Properties

[read-only]
static
InstanceCookieSyncManager. Singleton access to a CookieSyncManager.

Protected Properties

MDataBaseWebViewDatabase.
MHandlerHandler.
[read-only]
override
ThresholdClassIntPtr. This API supports the Mono for Android infrastructure and is not intended to be used directly from your code.
[read-only]
override
ThresholdTypeType. This API supports the Mono for Android infrastructure and is not intended to be used directly from your code.

Public Methods

static
CreateInstance(Context) : CookieSyncManager
Create a singleton CookieSyncManager within a context
override
ResetSync()
resetSync() resets sync manager's timer.
override
Run()
Starts executing the active part of the class' code.
override
StartSync()
startSync() requests sync manager to start sync.
override
StopSync()
stopSync() requests sync manager to stop sync. remove any SYNC_MESSAGE in the queue to break the sync loop
override
Sync()
sync() forces sync manager to sync now

Protected Methods