public class GeolocationPermissions extends Object
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.Modifier and Type | Class and Description |
---|---|
static interface |
GeolocationPermissions.Callback
A callback interface used by the host application to set the Geolocation
permission state for an origin.
|
Constructor and Description |
---|
GeolocationPermissions()
This class should not be instantiated directly, applications must only use
getInstance() to obtain the instance. |
Modifier and Type | Method and Description |
---|---|
void |
allow(String origin)
Allows the specified origin to use the Geolocation API.
|
void |
clear(String origin)
Clears the Geolocation permission state for the specified origin.
|
void |
clearAll()
Clears the Geolocation permission state for all origins.
|
void |
getAllowed(String origin,
ValueCallback<Boolean> callback)
Gets the Geolocation permission state for the specified origin.
|
static GeolocationPermissions |
getInstance()
Gets the singleton instance of this class.
|
void |
getOrigins(ValueCallback<Set<String>> callback)
Gets the set of origins for which Geolocation permissions are stored.
|
public GeolocationPermissions()
getInstance()
to obtain the instance.
Note this constructor was erroneously public and published in SDK levels prior to 16, but
applications using it would receive a non-functional instance of this class (there was no
way to call createHandler() and createUIHandler(), so it would not work).public static GeolocationPermissions getInstance()
WebView
instance.GeolocationPermissions
instancepublic void getOrigins(ValueCallback<Set<String>> callback)
callback
- a ValueCallback
to receive the result of this
request. This object's
onReceiveValue()
method will be invoked asynchronously with a set of
Strings containing the origins for which Geolocation
permissions are stored.public void getAllowed(String origin, ValueCallback<Boolean> callback)
origin
- the origin for which Geolocation permission is requestedcallback
- a ValueCallback
to receive the result of this
request. This object's
onReceiveValue()
method will be invoked asynchronously with a boolean
indicating whether or not the origin can use the
Geolocation API.public void clear(String origin)
origin
- the origin for which Geolocation permissions are clearedpublic void allow(String origin)
origin
- the origin for which Geolocation API use is allowedpublic void clearAll()