public final class

GeolocationPermissions

extends Object
java.lang.Object
   ↳ android.webkit.GeolocationPermissions

Class Overview

This class is used to get Geolocation permissions from, and set them on the WebView. For example, it could be used to allow a user to manage Geolocation permissions from a browser's UI. Permissions are managed on a per-origin basis, as required by the Geolocation spec - http://dev.w3.org/geo/api/spec-source.html. An origin specifies the scheme, host and port of particular frame. An origin is represented here as a string, using the output of WebCore::SecurityOrigin::toString. This class is the Java counterpart of the WebKit C++ GeolocationPermissions class. It simply marshalls calls from the UI thread to the WebKit thread. Within WebKit, Geolocation permissions may be applied either temporarily (for the duration of the page) or permanently. This class deals only with permanent permissions.

Summary

Nested Classes
interface GeolocationPermissions.Callback Callback interface used by the browser to report a Geolocation permission state set by the user in response to a permissions prompt. 
Public Constructors
GeolocationPermissions()
Public Methods
void allow(String origin)
Allows the specified origin.
void clear(String origin)
Clears the permission state for the specified origin.
void clearAll()
Clears the permission state for all origins.
void getAllowed(String origin, ValueCallback<Boolean> callback)
Gets the permission state for the specified origin.
static GeolocationPermissions getInstance()
Gets the singleton instance of the class.
void getOrigins(ValueCallback<Set<String>> callback)
Gets the set of origins for which Geolocation permissions are stored.
[Expand]
Inherited Methods
From class java.lang.Object

Public Constructors

public GeolocationPermissions ()

Since: API Level 5

Public Methods

public void allow (String origin)

Since: API Level 7

Allows the specified origin. This method may be called before the WebKit thread has intialized the message handler. Messages will be queued until this time.

public void clear (String origin)

Since: API Level 7

Clears the permission state for the specified origin. This method may be called before the WebKit thread has intialized the message handler. Messages will be queued until this time.

public void clearAll ()

Since: API Level 7

Clears the permission state for all origins.

public void getAllowed (String origin, ValueCallback<Boolean> callback)

Since: API Level 7

Gets the permission state for the specified origin. Callback is a ValueCallback object whose onReceiveValue method will be called asynchronously with the permission state for the origin.

public static GeolocationPermissions getInstance ()

Since: API Level 7

Gets the singleton instance of the class.

public void getOrigins (ValueCallback<Set<String>> callback)

Since: API Level 7

Gets the set of origins for which Geolocation permissions are stored. Note that we represent the origins as strings. These are created using WebCore::SecurityOrigin::toString(). As long as all 'HTML 5 modules' (Database, Geolocation etc) do so, it's safe to match up origins based on this string. Callback is a ValueCallback object whose onReceiveValue method will be called asynchronously with the set of origins.