I want to connect Android device to a host device. The android device will work as an accessory as the host will power the bus. My application code for android looks like:
Android Manifest
<intent-filter>
<action android:name="android.hardware.usb.action.USB_ACCESSORY_ATTACHED" />
</intent-filter>
<meta-data android:name="android.hardware.usb.action.USB_ACCESSORY_ATTACHED"
android:resource="@xml/usb_xml" />
The usb xml looks like: usb_xml
<resources>
<usb-accessory model="Google Inc" manufacturer="0x2D01" version="2.12.1.0"/>
</resources>
Is it mandatory to have the usb.xml ??
So when I am trying to get the connected USBDevice details, the USB Device list is always null :
UsbManager manager = (UsbManager) getSystemService(Context.USB_SERVICE);
Map<String,UsbDevice> deviceList = manager.getDeviceList();
Again, I also tried to get the accessory list, the USB accessorylist is also null
UsbAccessory[] accessoryList = manager.getAccessoryList();
I don't know what is the problem. I am having an HP laptop connected with a Samsung mobile (GellyBean(17) > 12 API)., where HP laptop is the host and Samsung mobile is accesosory
Some one Please help me I am stuck for a long time.