onGeolocationPermissionsShowPrompt property

  1. @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')])
FutureOr<GeolocationPermissionShowPromptResponse?> Function(T controller, String origin)? onGeolocationPermissionsShowPrompt
final

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:

Parameters - Officially Supported Platforms/Implementations:

  • origin: all platforms

Use the PlatformWebViewCreationParams.isPropertySupported method to check if this property 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',
    ),
  ],
)
final FutureOr<GeolocationPermissionShowPromptResponse?> Function(
  T controller,
  String origin,
)?
onGeolocationPermissionsShowPrompt;