Android Guides | Samples

Android.Hardware.Usb.UsbManager.RequestPermission Method

Requests temporary permission for the given package to access the device.

Syntax

[Android.Runtime.Register("requestPermission", "(Landroid/hardware/usb/UsbDevice;Landroid/app/PendingIntent;)V", "GetRequestPermission_Landroid_hardware_usb_UsbDevice_Landroid_app_PendingIntent_Handler")]
public virtual Void RequestPermission (UsbDevice device, PendingIntent pi)

Parameters

device
to request permissions for
pi
PendingIntent for returning result

Remarks

Requests temporary permission for the given package to access the device. This may result in a system dialog being displayed to the user if permission had not already been granted. Success or failure is returned via the PendingIntent pi. If successful, this grants the caller permission to access the device only until the device is disconnected. The following extras will be added to pi:

[Android Documentation]

Requirements

Namespace: Android.Hardware.Usb
Assembly: Mono.Android (in Mono.Android.dll)
Assembly Versions: 0.0.0.0
Since: Added in API level 12