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 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

interface GeolocationPermissions.Callback

A callback interface used by the host application to set the Geolocation permission state for an origin. 

Public methods

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.

Inherited methods