Allowing Android app to access USB device

Hi all!

I’ve been searching a lot for this, and I’ve found many similar questions. Unfortunately, I cannot seem to find the solution. Since I’m building an Android app on Unity, I’d like to bother you with my question :slight_smile:

I’m using Android 7.1.2 on an oDroid, connected with an external USB camera. It’s asking (during runtime) for permissions to use the USB Devices, and when pressed OK all goes well. However, the Use by default for this USB device checkbox does not really seem to do anything. Most people say that I have to use an intent filter in the manifest (located in Assets\Plugins\Android).

In * application * → activity I have:

	<action android:name="android.hardware.usb.action.USB_DEVICE_ATTACHED" />		
	<action android:name="android.hardware.usb.action.USB_ACCESSORY_ATTACHED" />		

Als in activity I have:

 <meta-data android:name="android.hardware.usb.action.USB_DEVICE_ATTACHED" android:resource="@xml/usb_device_filter" />  
  <meta-data android:name="android.hardware.usb.action.USB_ACCESSORY_ATTACHED" android:resource="@xml/usb_accessory_filter" />  

These files are in Assets\Plugins\Android\res\xml . Is that the correct location?

The xml file contains:

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

    <usb-accessory vendor-id="2760" product-id="13424" />

I found the vendor id and product id in the logcat while connecting.

The problem is that everytime I reboot, the messages reappear. I don’t want that, because normally I don’t use a keyboard.

Hope someone can help me!

@rkauw I am facing the same issue. Could you solve the problem?