USB detection app shows nothing in Android 4.0.3 Smile Pro when i connect any USB
<p>I am using Eclipse and I have installed the app in my Android phone.</p>

<p><strong>Main Activity Code :</strong></p>

<p>package com.example.usbdetection;</p>

<pre><code> import android.app.Activity;
 import android.app.PendingIntent;
import android.content.BroadcastReceiver;
 import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
 import android.hardware.usb.UsbDevice;
import android.hardware.usb.UsbManager;
 import android.os.Bundle;
 import android.util.Log;

public class MainActivity extends Activity {



UsbManager usbManager;
    PendingIntent mPermissionIntent;
    UsbDevice usbDevice;
    Intent intent;
    final String ACTION_USB_PERMISSION = "com.example.usbdetection.USB_PERMISSION";

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        usbManager = (UsbManager) getSystemService(Context.USB_SERVICE);
        mPermissionIntent = PendingIntent.getBroadcast(this, 0, new Intent(
                ACTION_USB_PERMISSION), 0);

        IntentFilter filter = new IntentFilter();
        filter.addAction(UsbManager.ACTION_USB_DEVICE_ATTACHED);
        filter.addAction(ACTION_USB_PERMISSION);
        registerReceiver(mUsbReceiver, filter);
    }

private final BroadcastReceiver mUsbReceiver = new BroadcastReceiver() {
    @Override
    public void onReceive(Context context, Intent intent) {

        String action = intent.getAction();
        if (ACTION_USB_PERMISSION.equals(action)) {
            synchronized (this) {

                usbDevice = (UsbDevice) intent
                        .getParcelableExtra(UsbManager.EXTRA_DEVICE);
                usbManager.requestPermission(usbDevice, mPermissionIntent);

                if (intent.getBooleanExtra(
                        UsbManager.EXTRA_PERMISSION_GRANTED, false)) {
                    if (usbDevice != null) {
                        // call method to set up device communication

                        int deviceId = usbDevice.getDeviceId();
                        int productId = usbDevice.getProductId();
                        Log.i("device id", "****" + deviceId);
                        Log.i("product id", "****" + productId);

                    } else {
                        Log.i("device id", "No USB device");
                    }

                } else {
                    Log.d("shiv", "permission denied for device ");
                }
            }
        }
    }
};
</code></pre>

<p>}</p>

<p>Manifest file :</p>

<p>
     </p>

<pre><code>&lt;uses-feature android:name="android.hardware.usb.host" /&gt;

&lt;uses-sdk
    android:minSdkVersion="12"
    android:targetSdkVersion="17" /&gt;

&lt;application
    android:allowBackup="true"
    android:icon="@drawable/ic_launcher"
    android:label="@string/app_name"
    android:theme="@style/AppTheme" &gt;
    &lt;activity
        android:name="com.example.usbdetection.MainActivity"
        android:label="@string/app_name" &gt;
        &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/device_filter" /&gt;
    &lt;/activity&gt;
&lt;/application&gt;
</code></pre>

<p></p>

<p>When I run my app and connect any USB it shows nothing. whats wrong?.</p>

<p>Any help would be appreciated :)</p>
