Android APIs
public interface

PermissionRequest

android.webkit.PermissionRequest

Class Overview

This interface defines a permission request and is used when web content requests access to protected resources. Either grant() or deny() must be called in UI thread to respond to the request.

Summary

Constants
long RESOURCE_AUDIO_CAPTURE Resource belongs to audio capture device, like microphone.
long RESOURCE_VIDEO_CAPTURE Resource belongs to video capture device, like camera.
Public Methods
abstract void deny()
Call this method to deny the request.
abstract Uri getOrigin()
abstract long getResources()
abstract void grant(long resources)
Call this method to grant origin the permission to access the given resources.

Constants

public static final long RESOURCE_AUDIO_CAPTURE

Resource belongs to audio capture device, like microphone.

Constant Value: 4 (0x0000000000000004)

public static final long RESOURCE_VIDEO_CAPTURE

Resource belongs to video capture device, like camera.

Constant Value: 2 (0x0000000000000002)

Public Methods

public abstract void deny ()

Call this method to deny the request.

public abstract Uri getOrigin ()

Returns
  • the origin of web content which attempt to access the restricted resources.

public abstract long getResources ()

Returns
  • a bit mask of resources the web content wants to access.

public abstract void grant (long resources)

Call this method to grant origin the permission to access the given resources. The granted permission is only valid for this WebView.

Parameters
resources the resources granted to be accessed by origin, to grant request, the requested resources returned by getResources() must be equals or a subset of granted resources. This parameter is designed to avoid granting permission by accident especially when new resources are requested by web content.