Added in [API level 5](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels) Summary: [Nested Classes](https://developer.android.com/reference/android/webkit/GeolocationPermissions#nestedclasses) \| [Methods](https://developer.android.com/reference/android/webkit/GeolocationPermissions#pubmethods) \| [Inherited Methods](https://developer.android.com/reference/android/webkit/GeolocationPermissions#inhmethods)

# GeolocationPermissions

*** ** * ** ***

` public class GeolocationPermissions `   
` extends https://developer.android.com/reference/java/lang/Object ` ` `

|---|---|
| [java.lang.Object](https://developer.android.com/reference/java/lang/Object) ||
| ↳ | android.webkit.GeolocationPermissions |

<br />

*** ** * ** ***

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, `https://developer.android.com/reference/android/webkit/WebChromeClient#onGeolocationPermissionsShowPrompt(java.lang.String,%20android.webkit.GeolocationPermissions.Callback)` 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` | `https://developer.android.com/reference/android/webkit/GeolocationPermissions.Callback` A callback interface used by the host application to set the Geolocation permission state for an origin. |

| ### Public methods ||
|---|---|
| ` void` | ` https://developer.android.com/reference/android/webkit/GeolocationPermissions#allow(java.lang.String)(https://developer.android.com/reference/java/lang/String origin) ` Allows the specified origin to use the Geolocation API. |
| ` void` | ` https://developer.android.com/reference/android/webkit/GeolocationPermissions#clear(java.lang.String)(https://developer.android.com/reference/java/lang/String origin) ` Clears the Geolocation permission state for the specified origin. |
| ` void` | ` https://developer.android.com/reference/android/webkit/GeolocationPermissions#clearAll()() ` Clears the Geolocation permission state for all origins. |
| ` void` | ` https://developer.android.com/reference/android/webkit/GeolocationPermissions#getAllowed(java.lang.String,%20android.webkit.ValueCallback<java.lang.Boolean>)(https://developer.android.com/reference/java/lang/String origin, https://developer.android.com/reference/android/webkit/ValueCallback<https://developer.android.com/reference/java/lang/Boolean> callback) ` Gets the Geolocation permission state for the specified origin. |
| ` static https://developer.android.com/reference/android/webkit/GeolocationPermissions` | ` https://developer.android.com/reference/android/webkit/GeolocationPermissions#getInstance()() ` Gets the singleton instance of this class. |
| ` void` | ` https://developer.android.com/reference/android/webkit/GeolocationPermissions#getOrigins(android.webkit.ValueCallback<java.util.Set<java.lang.String>>)(https://developer.android.com/reference/android/webkit/ValueCallback<https://developer.android.com/reference/java/util/Set<https://developer.android.com/reference/java/lang/String>> callback) ` Gets the set of origins for which Geolocation permissions are stored. |

### Inherited methods

From class ` https://developer.android.com/reference/java/lang/Object ` ` https://developer.android.com/reference/java/lang/Object` ` https://developer.android.com/reference/java/lang/Object#clone()() `

Creates and returns a copy of this object.
` boolean` ` https://developer.android.com/reference/java/lang/Object#equals(java.lang.Object)(https://developer.android.com/reference/java/lang/Object obj) `

Indicates whether some other object is "equal to" this one.
` void` ` https://developer.android.com/reference/java/lang/Object#finalize()() `

Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.
` final https://developer.android.com/reference/java/lang/Class<?>` ` https://developer.android.com/reference/java/lang/Object#getClass()() `

Returns the runtime class of this `Object`.
` int` ` https://developer.android.com/reference/java/lang/Object#hashCode()() `

Returns a hash code value for the object.
` final void` ` https://developer.android.com/reference/java/lang/Object#notify()() `

Wakes up a single thread that is waiting on this object's monitor.
` final void` ` https://developer.android.com/reference/java/lang/Object#notifyAll()() `

Wakes up all threads that are waiting on this object's monitor.
` https://developer.android.com/reference/java/lang/String` ` https://developer.android.com/reference/java/lang/Object#toString()() `

Returns a string representation of the object.
` final void` ` https://developer.android.com/reference/java/lang/Object#wait(long,%20int)(long timeoutMillis, int nanos) `

Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*, or until a certain amount of real time has elapsed.
` final void` ` https://developer.android.com/reference/java/lang/Object#wait(long)(long timeoutMillis) `

Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*, or until a certain amount of real time has elapsed.
` final void` ` https://developer.android.com/reference/java/lang/Object#wait()() `

Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*.

## Public methods

### allow

Added in [API level 7](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void allow (String origin)
```

Allows the specified origin to use the Geolocation API.

<br />

| Parameters ||
|---|---|
| `origin` | `String`: the origin for which Geolocation API use is allowed <br /> |

### clear

Added in [API level 7](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void clear (String origin)
```

Clears the Geolocation permission state for the specified origin.

<br />

| Parameters ||
|---|---|
| `origin` | `String`: the origin for which Geolocation permissions are cleared <br /> |

### clearAll

Added in [API level 7](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void clearAll ()
```

Clears the Geolocation permission state for all origins.

<br />

### getAllowed

Added in [API level 7](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

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

Gets the Geolocation permission state for the specified origin.

<br />

| Parameters ||
|---|---|
| `origin` | `String`: the origin for which Geolocation permission is requested <br /> |
| `callback` | `ValueCallback`: a `https://developer.android.com/reference/android/webkit/ValueCallback` to receive the result of this request. This object's `https://developer.android.com/reference/android/webkit/ValueCallback#onReceiveValue(T)` method will be invoked asynchronously with a boolean indicating whether or not the origin can use the Geolocation API. <br /> |

### getInstance

Added in [API level 7](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static GeolocationPermissions getInstance ()
```

Gets the singleton instance of this class. This method cannot be called before the application instantiates a `https://developer.android.com/reference/android/webkit/WebView` instance.

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/webkit/GeolocationPermissions` | the singleton `https://developer.android.com/reference/android/webkit/GeolocationPermissions` instance <br /> |

### getOrigins

Added in [API level 7](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

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

Gets the set of origins for which Geolocation permissions are stored.

<br />

| Parameters ||
|---|---|
| `callback` | `ValueCallback`: a `https://developer.android.com/reference/android/webkit/ValueCallback` to receive the result of this request. This object's `https://developer.android.com/reference/android/webkit/ValueCallback#onReceiveValue(T)` method will be invoked asynchronously with a set of Strings containing the origins for which Geolocation permissions are stored. <br /> |