WebViewDatabase
abstract class WebViewDatabase
kotlin.Any | |
↳ | android.webkit.WebViewDatabase |
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 | |
---|---|
Public methods | |
---|---|
abstract Unit |
Clears any saved data for web forms. |
abstract Unit |
Clears any saved credentials for HTTP authentication. |
abstract Unit |
Clears any saved username/password pairs for web forms. |
abstract Array<String!>? |
getHttpAuthUsernamePassword(host: String!, realm: String!) Retrieves HTTP authentication credentials for a given host and realm from the |
open static WebViewDatabase! |
getInstance(context: Context!) |
abstract Boolean |
Gets whether there is any saved data for web forms. |
abstract Boolean |
Gets whether there are any saved credentials for HTTP authentication. |
abstract Boolean |
Gets whether there are any saved username/password pairs for web forms. |
abstract Unit |
setHttpAuthUsernamePassword(host: String!, realm: String!, username: String!, password: String!) Stores HTTP authentication credentials for a given host and realm to the |
Public constructors
WebViewDatabase
WebViewDatabase()
Deprecated: This class should not be constructed by applications, use getInstance(android.content.Context)
instead to fetch the singleton instance.
Public methods
clearFormData
abstract funclearFormData(): Unit
Deprecated: Deprecated in Java.
Clears any saved data for web forms.
See Also
clearHttpAuthUsernamePassword
abstract fun clearHttpAuthUsernamePassword(): Unit
Clears any saved credentials for HTTP authentication. This method only clears the username and password stored in WebViewDatabase instance. The username and password are not read from the WebViewDatabase
during WebViewClient.onReceivedHttpAuthRequest
. It is up to the app to do this or not.
The username and password used for http authentication might be cached in the network stack itself, and are not cleared when this method is called. WebView does not provide a special mechanism to clear HTTP authentication for implementing client logout. The client logout mechanism should be implemented by the Web site designer (such as server sending a HTTP 401 for invalidating credentials).
clearUsernamePassword
abstract funclearUsernamePassword(): Unit
Deprecated: 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.
getHttpAuthUsernamePassword
abstract fun getHttpAuthUsernamePassword(
host: String!,
realm: String!
): Array<String!>?
Retrieves HTTP authentication credentials for a given host and realm from the WebViewDatabase
instance.
Parameters | |
---|---|
host |
String!: the host to which the credentials apply |
realm |
String!: the realm to which the credentials apply |
Return | |
---|---|
Array<String!>? |
the credentials as a String array, if found. The first element is the username and the second element is the password. null if no credentials are found. |
hasFormData
abstract funhasFormData(): Boolean
Deprecated: Deprecated in Java.
Gets whether there is any saved data for web forms.
Return | |
---|---|
Boolean |
whether there is any saved data for web forms |
See Also
hasHttpAuthUsernamePassword
abstract fun hasHttpAuthUsernamePassword(): Boolean
Gets whether there are any saved credentials for HTTP authentication.
Return | |
---|---|
Boolean |
whether there are any saved credentials |
hasUsernamePassword
abstract funhasUsernamePassword(): Boolean
Deprecated: 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.
Return | |
---|---|
Boolean |
true if there are any saved username/password pairs |
setHttpAuthUsernamePassword
abstract fun setHttpAuthUsernamePassword(
host: String!,
realm: String!,
username: String!,
password: String!
): Unit
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 |