WebViewDatabase | API reference | Android Developers
Summary: Ctors | Methods | Inherited Methods
public
abstract
class
WebViewDatabase
extends Object
This class allows developers to determine whether any WebView used in the application has stored any of the following types of browsing data and to clear any such stored data for all WebViews in the application.
- Username/password pairs for web forms
- HTTP authentication username/password pairs
- Data entered into text fields (e.g. for autocomplete suggestions)
Summary
Public constructors | |
|---|---|
WebViewDatabase()
This constructor is deprecated.
This class should not be constructed by applications, use |
|
Public methods | |
|---|---|
abstract
void
|
clearFormData()
Clears any saved data for web forms. |
abstract
void
|
clearHttpAuthUsernamePassword()
Clears any saved credentials for HTTP authentication. |
abstract
void
|
clearUsernamePassword()
This method was deprecated in API level 18. Saving passwords in WebView will not be supported in future versions. |
abstract
String[]
|
getHttpAuthUsernamePassword(String host, String realm)
Retrieves HTTP authentication credentials for a given host and realm from the |
static
WebViewDatabase
|
getInstance(Context context)
|
abstract
boolean
|
hasFormData()
Gets whether there is any saved data for web forms. |
abstract
boolean
|
hasHttpAuthUsernamePassword()
Gets whether there are any saved credentials for HTTP authentication. |
abstract
boolean
|
hasUsernamePassword()
This method was deprecated in API level 18. Saving passwords in WebView will not be supported in future versions. |
abstract
void
|
setHttpAuthUsernamePassword(String host, String realm, String username, String password)
Stores HTTP authentication credentials for a given host and realm to the |
Inherited methods | |||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
From class
| |||||||||||||||||||||||
Public constructors
WebViewDatabase
public WebViewDatabase ()
This constructor is deprecated.
This class should not be constructed by applications, use getInstance(Context) instead to fetch the singleton instance.
Public methods
clearFormData
public abstract void clearFormData ()
Clears any saved data for web forms.
clearUsernamePassword
public abstract void clearUsernamePassword ()
This method was deprecated
in API level 18.
Saving passwords in WebView will not be supported in future versions.
Clears any saved username/password pairs for web forms. Note that these are unrelated to HTTP authentication credentials.
hasFormData
public abstract boolean hasFormData ()
Gets whether there is any saved data for web forms.
| Returns | |
|---|---|
boolean |
whether there is any saved data for web forms |
hasUsernamePassword
public abstract boolean hasUsernamePassword ()
This method was deprecated
in API level 18.
Saving passwords in WebView will not be supported in future versions.
Gets whether there are any saved username/password pairs for web forms. Note that these are unrelated to HTTP authentication credentials.
| Returns | |
|---|---|
boolean |
true if there are any saved username/password pairs |
setHttpAuthUsernamePassword
public abstract void setHttpAuthUsernamePassword (String host, String realm, String username, String password)
Stores HTTP authentication credentials for a given host and realm to the WebViewDatabase
instance.
To use HTTP authentication, the embedder application has to implement
WebViewClient.onReceivedHttpAuthRequest, and call HttpAuthHandler.proceed
with the correct username and password.
The embedder app can get the username and password any way it chooses, and does not have to
use WebViewDatabase.
Notes:
WebViewDatabase is provided only as a convenience to store and retrieve http
authentication credentials. WebView does not read from it during HTTP authentication.
| Parameters | |
|---|---|
host |
String: the host to which the credentials apply |
realm |
String: the realm to which the credentials apply |
username |
String: the username |
password |
String: the password |