title: android how to register an app for "open with" selection
body: <p>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.</p>
  
  <p>So my simple question is: how can i get my own app inside the selection.</p>
  
  <p>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.</p>
  
  <p>Thanks to the comments i came up with this: </p>
  
  <pre><code>        &lt;activity
              android:name=".MainActivity"
              android:label="@string/app_name"&gt;
              &lt;intent-filter&gt;
                  &lt;action android:name="android.hardware.usb.action.USB_DEVICE_ATTACHED" /&gt;
              &lt;/intent-filter&gt;
              &lt;meta-data android:name="android.hardware.usb.action.USB_DEVICE_ATTACHED" /&gt;
          &lt;/activity&gt;
  </code></pre>
  
  <p>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.</p>
  
  <p>Edit:
  Solution:
  I had to add: <code>&lt;uses-feature android:name="android.hardware.usb.accessory" /&gt;</code>
  and </p>
  
  <pre><code>&lt;intent-filter&gt;
                  &lt;action android:name="android.intent.action.MAIN" /&gt;
  
                  &lt;category android:name="android.intent.category.LAUNCHER" /&gt;
              &lt;/intent-filter&gt;
              &lt;intent-filter&gt;
                  &lt;action android:name="android.hardware.usb.action.USB_DEVICE_ATTACHED" /&gt;
              &lt;/intent-filter&gt;
              &lt;meta-data android:name="android.hardware.usb.action.USB_DEVICE_ATTACHED" android:resource="@xml/usb_device_filter" /&gt;
  </code></pre>
  
  <p>while stting at least <code>protocol="0"</code> in the filter.</p>