USB Permissions Handling

When connecting supported readers to a device via USB, permission will be requested and some extra steps need to be taken to prevent the permission from being re-requested.

Android

An intent-filter for USB_DEVICE_ATTACHED should be registered in the Android manifest, this would look something like:

<application
    ...>
    <activity
        ...>
        ...
        <intent-filter>
            <action android:name="android.hardware.usb.action.USB_DEVICE_ATTACHED" />
        </intent-filter>
        <meta-data android:name="android.hardware.usb.action.USB_DEVICE_ATTACHED" android:resource="@xml/usb_device_filter" />
    </activity>
    ...
</application>

The intent-filter depends on the named xml resource file to match vendor and product ids reported by the devices; the following should cover all versions of the reader hardware:

<?xml version="1.0" encoding="utf-8"?>

<resources>
    <usb-device vendor-id="1155" product-id="22352" />
    <usb-device vendor-id="5538" product-id="257" />
    <usb-device vendor-id="11369" product-id="22352" />
    <usb-device vendor-id="11369" product-id="257" />
</resources>