Android Guides | Samples

Android.Hardware.Usb.UsbManager.RequestPermission Method

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

Syntax

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

Parameters

accessory
to request permissions for
pi
PendingIntent for returning result

Remarks

Requests temporary permission for the given package to access the accessory. 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 accessory 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