Here's a small library that enables you to manage any cookies used by a WebView in your application.
CookieManager
Version: 1.16
For an example of usage take a look here: http://www.b4x.com/forum/basic4andr...-load-url-username-password-2.html#post131419, and here: http://www.b4x.com/forum/basic4andr...-load-url-username-password-2.html#post134391.
Martin.
CookieManager
Version: 1.16
- CookieManager
Methods:- GetAcceptCookies As Boolean
Returns True if cookies will be accepted by your application. - GetAllowFileSchemeCookies As Boolean
Gets whether the application's WebView instances send and accept cookies for file scheme URLs. - GetCookie (Url As String) As String
Returns the cookie for the given Url in the format: NAME=VALUE [; NAME=VALUE]
If no cookie exists for the Url then a null value will be returned. - HasCookies As Boolean
Returns True if any cookies are stored for your application. - RemoveAllCookies
Removes all cookies stored for your application. - RemoveExpiredCookies
Removes all expired cookies stored for your application. - RemoveSessionCookies
Removes all session cookies stored for your application. - SetAcceptCookies (Accept As Boolean)
Set whether cookies will be accepted for your application. - SetAcceptFileSchemeCookies (Accept As Boolean)
Sets whether the application's WebView instances should send and accept cookies for file scheme URLs. - SetCookie (Url As String, Value As String)
Sets the cookie for the Url to the Value.
- GetAcceptCookies As Boolean
- CookieSyncManager
Methods:- CreateInstance
Creates an instance of the CookieSyncManager.
The CookieSyncManager is used to synchronise 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 with a 5 minute interval. - ResetSync
Resets the CookieSyncManager timer. - StartSync
Requests the CookieSyncManager to start synchronisation.
Typically called in Activity_Resume. - StopSync
Requests the CookieSyncManager to stop synchronisation.
Typically called in Activity_Pause. - Sync
Forces the CookieSyncManager to synchronise now.
This method is asynchronous, there is no guarantee it will synchronise immediately.
- CreateInstance
For an example of usage take a look here: http://www.b4x.com/forum/basic4andr...-load-url-username-password-2.html#post131419, and here: http://www.b4x.com/forum/basic4andr...-load-url-username-password-2.html#post134391.
Martin.
Attachments
Last edited: