Build 1.0_r1(from source)

android.webkit
Class CookieSyncManager

java.lang.Object
  extended by android.webkit.WebSyncManager
      extended by android.webkit.CookieSyncManager
All Implemented Interfaces:
Runnable

public final class CookieSyncManager
extends WebSyncManager

The class CookieSyncManager is used to synchronize the browser cookies between RAM and FLASH. To get the best performance, browser cookie is saved in RAM. We use a separate thread to sync the cookies between RAM and FLASH on a timer base.

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 its Activity.onResume(), and call

CookieSyncManager.getInstance().stopSync()

in its Activity.onStop().

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

CookieSyncManager.getInstance().sync()


Field Summary
 
Fields inherited from class android.webkit.WebSyncManager
LOGTAG, mDataBase, mHandler
 
Method Summary
(package private)  void clearAllCookies()
          Package level api, called from CookieManager Clear all cookies in the database
(package private)  void clearExpiredCookies(long now)
          Package level api, called from CookieManager Clear all expired cookies in the database
(package private)  void clearSessionCookies()
          Package level api, called from CookieManager Clear all session cookies in the database
static CookieSyncManager createInstance(Context context)
          Create a singleton CookieSyncManager within a context
(package private)  ArrayList<CookieManager.Cookie> getCookiesForDomain(String domain)
          Package level api, called from CookieManager Get all the cookies which matches a given base domain.
static CookieSyncManager getInstance()
          Singleton access to a CookieSyncManager.
(package private)  boolean hasCookies()
          Returns true if there are any saved cookies.
protected  void syncFromRamToFlash()
           
 
Methods inherited from class android.webkit.WebSyncManager
clone, onSyncInit, resetSync, run, startSync, stopSync, sync
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getInstance

public static CookieSyncManager getInstance()
Singleton access to a CookieSyncManager. An IllegalStateException will be thrown if createInstance(Context) is not called before.

Returns:
CookieSyncManager

createInstance

public static CookieSyncManager createInstance(Context context)
Create a singleton CookieSyncManager within a context

Parameters:
context -
Returns:
CookieSyncManager

getCookiesForDomain

ArrayList<CookieManager.Cookie> getCookiesForDomain(String domain)
Package level api, called from CookieManager Get all the cookies which matches a given base domain.

Parameters:
domain -
Returns:
A list of Cookie

clearAllCookies

void clearAllCookies()
Package level api, called from CookieManager Clear all cookies in the database


hasCookies

boolean hasCookies()
Returns true if there are any saved cookies.


clearSessionCookies

void clearSessionCookies()
Package level api, called from CookieManager Clear all session cookies in the database


clearExpiredCookies

void clearExpiredCookies(long now)
Package level api, called from CookieManager Clear all expired cookies in the database


syncFromRamToFlash

protected void syncFromRamToFlash()
Specified by:
syncFromRamToFlash in class WebSyncManager

Build 1.0_r1(from source)

Please submit a feedback, bug or feature