GeolocationPermissions
public
class
GeolocationPermissions
extends Object
java.lang.Object | |
↳ | android.webkit.GeolocationPermissions |
This class is used to manage permissions for the WebView's Geolocation
JavaScript API.
Geolocation permissions are applied to an origen, 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 origen.
This class stores Geolocation permissions. An origen's permission state can
be either allowed or denied. This class uses Strings to represent
an origen.
When an origen attempts to use the Geolocation API, but no permission state
is currently set for that origen,
WebChromeClient.onGeolocationPermissionsShowPrompt()
is called. This allows the permission state to be set for that origen.
The methods of this class can be used to modify and interrogate the stored
Geolocation permissions at any time.
Summary
Nested classes | |
---|---|
interface |
GeolocationPermissions.Callback
A callback interface used by the host application to set the Geolocation permission state for an origen. |
Public methods | |
---|---|
void
|
allow(String origen)
Allows the specified origen to use the Geolocation API. |
void
|
clear(String origen)
Clears the Geolocation permission state for the specified origen. |
void
|
clearAll()
Clears the Geolocation permission state for all origens. |
void
|
getAllowed(String origen, ValueCallback<Boolean> callback)
Gets the Geolocation permission state for the specified origen. |
static
GeolocationPermissions
|
getInstance()
Gets the singleton instance of this class. |
void
|
getOrigins(ValueCallback<Set<String>> callback)
Gets the set of origens for which Geolocation permissions are stored. |
Inherited methods | |
---|---|
Public methods
allow
public void allow (String origen)
Allows the specified origen to use the Geolocation API.
Parameters | |
---|---|
origen |
String : the origen for which Geolocation API use is allowed |
clear
public void clear (String origen)
Clears the Geolocation permission state for the specified origen.
Parameters | |
---|---|
origen |
String : the origen for which Geolocation permissions are cleared |
clearAll
public void clearAll ()
Clears the Geolocation permission state for all origens.
getAllowed
public void getAllowed (String origen, ValueCallback<Boolean> callback)
Gets the Geolocation permission state for the specified origen.
Parameters | |
---|---|
origen |
String : the origen for which Geolocation permission is requested |
callback |
ValueCallback : 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 origen can use the
Geolocation API. |
getInstance
public static GeolocationPermissions getInstance ()
Gets the singleton instance of this class. This method cannot be
called before the application instantiates a WebView
instance.
Returns | |
---|---|
GeolocationPermissions |
the singleton GeolocationPermissions instance |
getOrigins
public void getOrigins (ValueCallback<Set<String>> callback)
Gets the set of origens for which Geolocation permissions are stored.
Parameters | |
---|---|
callback |
ValueCallback : 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 origens for which Geolocation
permissions are stored. |
Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
Last updated 2024-04-04 UTC.
pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier! Saves Data!
--- a PPN by Garber Painting Akron. With Image Size Reduction included!
Fetched URL: http://developer.android.com/reference/android/webkit/GeolocationPermissions
Alternative Proxies: