UsbPermissionManager

public class UsbPermissionManager extends AbstractManager<Service>

Compared to the default permission manager of Android, this one can persist permissions across package re-installations, as this one uses the package name instead of UID.

Here it is possible to grant or deny access for all USB devices and accessories to a package in one go, instead of the default one that operates on individual device identifiers.

Functions

Link copied to clipboard
public static UsbPermissionManager getInstance(@NonNull() Context context)
Returns an instance of UsbPermissionManager which can be used for granting or denying USB device/accessory access permissions to packages.
Link copied to clipboard
@MinApiLevel(value = 4)
public boolean isAccessGranted(@NonNull() String packageName)
Returns the grant status of USB access permission for the given app.
Link copied to clipboard
@MinApiLevel(value = 4)
public void setAccessGranted(@NonNull() String packageName, boolean isGranted)
Grants or denies USB access permissions for an app.