GeolocationPermissions
open class GeolocationPermissions
kotlin.Any | |
↳ | android.webkit.GeolocationPermissions |
This class is used to manage permissions for the WebView's Geolocation JavaScript API. Geolocation permissions are applied to an origin, which consists of the host, scheme and port of a URI. In order for web content to use the Geolocation API, permission must be granted for that content's origin. This class stores Geolocation permissions. An origin's permission state can be either allowed or denied. This class uses Strings to represent an origin. When an origin attempts to use the Geolocation API, but no permission state is currently set for that origin, WebChromeClient.onGeolocationPermissionsShowPrompt()
is called. This allows the permission state to be set for that origin. The methods of this class can be used to modify and interrogate the stored Geolocation permissions at any time.
Summary
Nested classes | |
---|---|
abstract |
A callback interface used by the host application to set the Geolocation permission state for an origin. |
Public methods | |
---|---|
open Unit |
Allows the specified origin to use the Geolocation API. |
open Unit |
Clears the Geolocation permission state for the specified origin. |
open Unit |
clearAll() Clears the Geolocation permission state for all origins. |
open Unit |
getAllowed(origin: String!, callback: ValueCallback<Boolean!>!) Gets the Geolocation permission state for the specified origin. |
open static GeolocationPermissions! |
Gets the singleton instance of this class. |
open Unit |
getOrigins(callback: ValueCallback<MutableSet<String!>!>!) Gets the set of origins for which Geolocation permissions are stored. |
Public methods
allow
open fun allow(origin: String!): Unit
Allows the specified origin to use the Geolocation API.
Parameters | |
---|---|
origin |
String!: the origin for which Geolocation API use is allowed |
clear
open fun clear(origin: String!): Unit
Clears the Geolocation permission state for the specified origin.
Parameters | |
---|---|
origin |
String!: the origin for which Geolocation permissions are cleared |
clearAll
open fun clearAll(): Unit
Clears the Geolocation permission state for all origins.
getAllowed
open fun getAllowed(
origin: String!,
callback: ValueCallback<Boolean!>!
): Unit
Gets the Geolocation permission state for the specified origin.
Parameters | |
---|---|
origin |
String!: the origin for which Geolocation permission is requested |
callback |
ValueCallback<Boolean!>!: a ValueCallback to receive the result of this request. This object's android.webkit.ValueCallback#onReceiveValue(T) method will be invoked asynchronously with a boolean indicating whether or not the origin can use the Geolocation API. |
getInstance
open static fun getInstance(): GeolocationPermissions!
Gets the singleton instance of this class. This method cannot be called before the application instantiates a WebView
instance.
Return | |
---|---|
GeolocationPermissions! |
the singleton GeolocationPermissions instance |
getOrigins
open fun getOrigins(callback: ValueCallback<MutableSet<String!>!>!): Unit
Gets the set of origins for which Geolocation permissions are stored.
Parameters | |
---|---|
callback |
ValueCallback<MutableSet<String!>!>!: a ValueCallback to receive the result of this request. This object's android.webkit.ValueCallback#onReceiveValue(T) method will be invoked asynchronously with a set of Strings containing the origins for which Geolocation permissions are stored. |