Interface GeckoSession.PermissionDelegate

Enclosing class:

public static interface GeckoSession.PermissionDelegate
GeckoSession applications implement this interface to handle requests for permissions from content, such as geolocation and notifications. For each permission, usually two requests are generated: one request for the Android app permission through requestAppPermissions, which is typically handled by a system permission dialog; and another request for the content permission (e.g. through requestContentPermission), which is typically handled by an app-specific permission dialog.

When denying an Android app permission, the response is not stored by GeckoView. It is the responsibility of the consumer to store the response state and therefore prevent further requests from being presented to the user.

  • Field Details


      static final int PERMISSION_GEOLOCATION
      Permission for using the geolocation API. See:
      See Also:

      Permission for using the notifications API. See:
      See Also:

      Permission for using the storage API. See:
      See Also:

      static final int PERMISSION_XR
      Permission for using the WebXR API. See:
      See Also:

      Permission for allowing autoplay of inaudible (silent) video.
      See Also:

      static final int PERMISSION_AUTOPLAY_AUDIBLE
      Permission for allowing autoplay of audible video.
      See Also:

      Permission for accessing system media keys used to decode DRM media.
      See Also:

      static final int PERMISSION_TRACKING
      Permission for trackers to operate on the page -- disables all tracking protection features for a given site.
      See Also:

      static final int PERMISSION_STORAGE_ACCESS
      Permission for third party frames to access first party cookies. May be granted heuristically in some cases.
      See Also:
  • Method Details

    • onAndroidPermissionsRequest

      @UiThread default void onAndroidPermissionsRequest(@NonNull GeckoSession session, @Nullable String[] permissions, @NonNull GeckoSession.PermissionDelegate.Callback callback)
      Request Android app permissions.
      session - GeckoSession instance requesting the permissions.
      permissions - List of permissions to request; possible values are, android.Manifest.permission.ACCESS_COARSE_LOCATION android.Manifest.permission.ACCESS_FINE_LOCATION android.Manifest.permission.CAMERA android.Manifest.permission.RECORD_AUDIO
      callback - Callback interface.
    • onContentPermissionRequest

      @UiThread @Nullable default GeckoResult<Integer> onContentPermissionRequest(@NonNull GeckoSession session, @NonNull GeckoSession.PermissionDelegate.ContentPermission perm)
      Request content permission.

      Note, that in the case of PERMISSION_PERSISTENT_STORAGE, once permission has been granted for a site, it cannot be revoked. If the permission has previously been granted, it is the responsibility of the consuming app to remember the permission and prevent the prompt from being redisplayed to the user.

      session - GeckoSession instance requesting the permission.
      perm - An GeckoSession.PermissionDelegate.ContentPermission describing the permission being requested and its current status.
      A GeckoResult resolving to one of VALUE_*, determining the response to the permission request and updating the permissions for this site.
    • onMediaPermissionRequest

      @UiThread default void onMediaPermissionRequest(@NonNull GeckoSession session, @NonNull String uri, @Nullable GeckoSession.PermissionDelegate.MediaSource[] video, @Nullable GeckoSession.PermissionDelegate.MediaSource[] audio, @NonNull GeckoSession.PermissionDelegate.MediaCallback callback)
      Request content media permissions, including request for which video and/or audio source to use.

      Media permissions will still be requested if the associated device permissions have been denied if there are video or audio sources in that category that can still be accessed. It is the responsibility of consumers to ensure that media permission requests are not displayed in this case.

      session - GeckoSession instance requesting the permission.
      uri - The URI of the content requesting the permission.
      video - List of video sources, or null if not requesting video.
      audio - List of audio sources, or null if not requesting audio.
      callback - Callback interface.