onGeolocationPermissionsShowPrompt method
- @SupportedPlatforms.new(platforms: [AndroidPlatform(apiName: 'WebChromeClient.onGeolocationPermissionsShowPrompt', apiUrl: 'https://developer.android.com/reference/android/webkit/WebChromeClient#onGeolocationPermissionsShowPrompt(java.lang.String,%20android.webkit.GeolocationPermissions.Callback)'), IOSPlatform(apiName: 'WKUIDelegate.webView(_:requestGeolocationPermissionFor:initiatedByFrame:decisionHandler:)', apiUrl: 'https://developer.apple.com/documentation/webkit/wkuidelegate/webview(_:requestgeolocationpermissionfor:initiatedbyframe:decisionhandler:)', available: '27.0')])
- String origin
Event that notifies the host application that web content from the specified origin is attempting to use the Geolocation API, but no permission state is currently set for that origin.
Note that for applications targeting Android N and later SDKs (API level > Build.VERSION_CODES.M) this method is only called for requests originating from secure origins such as https.
On non-secure origins geolocation requests are automatically denied.
origin represents the origin of the web content attempting to use the Geolocation API.
On iOS 27 and later, allow is translated to WebKit's geolocation permission decision.
The retain value is preserved in the response contract, but persistence is managed by WebKit.
Officially Supported Platforms/Implementations:
- Android WebView (Official API - WebChromeClient.onGeolocationPermissionsShowPrompt)
- iOS WKWebView 27.0+ (Official API - WKUIDelegate.webView(_:requestGeolocationPermissionFor:initiatedByFrame:decisionHandler:))
Parameters - Officially Supported Platforms/Implementations:
origin: all platforms
Use the PlatformInAppBrowserEvents.isMethodSupported method to check if this method is supported at runtime.
Implementation
@SupportedPlatforms(
platforms: [
AndroidPlatform(
apiName: 'WebChromeClient.onGeolocationPermissionsShowPrompt',
apiUrl:
'https://developer.android.com/reference/android/webkit/WebChromeClient#onGeolocationPermissionsShowPrompt(java.lang.String,%20android.webkit.GeolocationPermissions.Callback)',
),
IOSPlatform(
apiName:
'WKUIDelegate.webView(_:requestGeolocationPermissionFor:initiatedByFrame:decisionHandler:)',
apiUrl:
'https://developer.apple.com/documentation/webkit/wkuidelegate/webview(_:requestgeolocationpermissionfor:initiatedbyframe:decisionhandler:)',
available: '27.0',
),
],
)
FutureOr<GeolocationPermissionShowPromptResponse?>?
onGeolocationPermissionsShowPrompt(String origin) {
return null;
}