Share via


WebSettings.SetGeolocationEnabled(Boolean) Method

Definition

Sets whether Geolocation is enabled.

[Android.Runtime.Register("setGeolocationEnabled", "(Z)V", "GetSetGeolocationEnabled_ZHandler")]
public abstract void SetGeolocationEnabled (bool flag);
[<Android.Runtime.Register("setGeolocationEnabled", "(Z)V", "GetSetGeolocationEnabled_ZHandler")>]
abstract member SetGeolocationEnabled : bool -> unit

Parameters

flag
Boolean

whether Geolocation should be enabled

Attributes

Remarks

Sets whether Geolocation is enabled. The default is true.

Please note that in order for the Geolocation API to be usable by a page in the WebView, the following requirements must be met: <ul> <li>an application must have permission to access the device location, see android.Manifest.permission#ACCESS_COARSE_LOCATION, android.Manifest.permission#ACCESS_FINE_LOCATION; <li>an application must provide an implementation of the WebChromeClient#onGeolocationPermissionsShowPrompt callback to receive notifications that a page is requesting access to location via the JavaScript Geolocation API. </ul>

Java documentation for android.webkit.WebSettings.setGeolocationEnabled(boolean).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to