title: How to make an basic Android USB Host application?
body: <p>I'm trying to develop a application which detects a USB device and shows a pop-up when it's connected.
  I followed the basic USB tutorial that you can find in Android Developers website (<a href="http://developer.android.com/guide/topics/connectivity/usb/host.html" rel="nofollow noreferrer">http://developer.android.com/guide/topics/connectivity/usb/host.html</a>)</p>
  <p>Here's my Android Manifest:</p>
  <pre><code>    &lt;manifest xmlns:android=&quot;http://schemas.android.com/apk/res/android&quot;
      package=&quot;br.com.habeis&quot;
      android:versionCode=&quot;1&quot;
      android:versionName=&quot;1.0&quot; &gt;
  
      &lt;uses-sdk
          android:minSdkVersion=&quot;15&quot;
          android:targetSdkVersion=&quot;15&quot; /&gt;
  
      &lt;application
          android:icon=&quot;@drawable/ic_launcher&quot;
          android:label=&quot;@string/app_name&quot;
          android:theme=&quot;@style/AppTheme&quot; &gt;
          &lt;activity
              android:name=&quot;.MainActivity&quot;
              android:label=&quot;@string/title_activity_main&quot; &gt;
              &lt;intent-filter&gt;
                  &lt;action android:name=&quot;android.intent.action.MAIN&quot; /&gt;
                  &lt;category android:name=&quot;android.intent.category.LAUNCHER&quot; /&gt;
              &lt;/intent-filter&gt;
              
              &lt;intent-filter&gt;
                  &lt;action android:name=&quot;android.hardware.usb.action.USB_DEVICE_ATTACHED&quot; /&gt;
              &lt;/intent-filter&gt;
              
              &lt;meta-data android:name=&quot;android.hardware.usb.action.USB_DEVICE_ATTACHED&quot;
                         android:resource=&quot;@xml/device_filter&quot; /&gt;
              
          &lt;/activity&gt;
      &lt;/application&gt;
  
  &lt;/manifest&gt;
  </code></pre>
  <p>And my device_filter.xml file:</p>
  <pre><code>    &lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
  &lt;resources&gt;
      &lt;usb-device vendor-id=&quot;0x1BCF&quot; product-id=&quot;0x0007&quot; /&gt;
  &lt;/resources&gt;
  </code></pre>
  <p>My Activity</p>
  <pre><code>package br.com.habeis;
  import java.util.HashMap;
  import java.util.Iterator;
  import android.hardware.usb.UsbDevice;
  import android.hardware.usb.UsbManager;
  import android.os.Bundle;
  import android.widget.Toast;
  import android.app.Activity;
  import android.content.Context;
  
  public class MainActivity extends Activity {
  
      @Override
      public void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_main);
          
    
          UsbManager manager = (UsbManager) getSystemService(Context.USB_SERVICE);
  
          HashMap&lt;String, UsbDevice&gt; deviceList = manager.getDeviceList();
          Iterator&lt;UsbDevice&gt; deviceIterator = deviceList.values().iterator();
          
          while(deviceIterator.hasNext()){
              
              UsbDevice device = deviceIterator.next();
              Toast.makeText(this,&quot;Value of device :&quot; +device.getDeviceName(), Toast.LENGTH_LONG).show();
             
          }
      }        
  }
  </code></pre>
  <p>Does anyone know what is missing in my code?</p>