When connecting an external device(e.g. camera) via usb to a android smartphone you usually get a pop-up: "Choose an app for the USB device" with some different applications in the select box.
So my simple question is: how can i get my own app inside the selection.
Everything I could find on stackoverflow are filter-intents, but i'm not even sure if this is the right direction as they are mainly used for file opening and stuff like that.
Thanks to the comments i came up with this:
<activity
android:name=".MainActivity"
android:label="@string/app_name">
<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" />
</activity>
If i got it right (apparently I don't) with this setup the application should now be visible in the selection when attaching a usb device, but it still isn't.
Edit:
Solution:
I had to add: <uses-feature android:name="android.hardware.usb.accessory" />
and
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<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" />
while stting at least protocol="0"
in the filter.