UsbManager.RequestPermission Method

Definition

Overloads

RequestPermission(UsbAccessory, PendingIntent)

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

RequestPermission(UsbDevice, PendingIntent)

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

RequestPermission(UsbAccessory, PendingIntent)

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

[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 (Android.Hardware.Usb.UsbAccessory? accessory, Android.App.PendingIntent? pi);
[<Android.Runtime.Register("requestPermission", "(Landroid/hardware/usb/UsbAccessory;Landroid/app/PendingIntent;)V", "GetRequestPermission_Landroid_hardware_usb_UsbAccessory_Landroid_app_PendingIntent_Handler")>]
abstract member RequestPermission : Android.Hardware.Usb.UsbAccessory * Android.App.PendingIntent -> unit
override this.RequestPermission : Android.Hardware.Usb.UsbAccessory * Android.App.PendingIntent -> unit

Parameters

accessory
UsbAccessory

to request permissions for

pi
PendingIntent

PendingIntent for returning result

Attributes

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 android.app.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: <ul> <li> #EXTRA_ACCESSORY containing the accessory passed into this call <li> #EXTRA_PERMISSION_GRANTED containing boolean indicating whether permission was granted by the user </ul>

Java documentation for android.hardware.usb.UsbManager.requestPermission(android.hardware.usb.UsbAccessory, android.app.PendingIntent).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to

RequestPermission(UsbDevice, PendingIntent)

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

[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 (Android.Hardware.Usb.UsbDevice? device, Android.App.PendingIntent? pi);
[<Android.Runtime.Register("requestPermission", "(Landroid/hardware/usb/UsbDevice;Landroid/app/PendingIntent;)V", "GetRequestPermission_Landroid_hardware_usb_UsbDevice_Landroid_app_PendingIntent_Handler")>]
abstract member RequestPermission : Android.Hardware.Usb.UsbDevice * Android.App.PendingIntent -> unit
override this.RequestPermission : Android.Hardware.Usb.UsbDevice * Android.App.PendingIntent -> unit

Parameters

device
UsbDevice

to request permissions for

pi
PendingIntent

PendingIntent for returning result

Attributes

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 android.app.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: <ul> <li> #EXTRA_DEVICE containing the device passed into this call <li> #EXTRA_PERMISSION_GRANTED containing boolean indicating whether permission was granted by the user </ul>

Permission for USB devices of class UsbConstants#USB_CLASS_VIDEO for clients that target SDK android.os.Build.VERSION_CODES#P and above can be granted only if they have additionally the android.Manifest.permission#CAMERA permission.

Java documentation for android.hardware.usb.UsbManager.requestPermission(android.hardware.usb.UsbDevice, android.app.PendingIntent).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to