See Also: CookieSyncManager Members
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, System.String). Note that even sync() happens asynchronously, so don't do it just as your activity is shutting down.