You are here
Home > Android >

USB Host API’s in the android.hardware.usb

When Android-powered device is in USB host mode, it acts as the USB host, powers the bus, and enumerates connected USB devices.

Manifest Requirements

Following things need to be add in Manifest file:

  • <uses-feature> element that declares that your application uses the android.hardware.usb.host feature.
  • Set the minimum SDK of the application to API Level 12 or higher.
  • add <intent-filter>(USB_DEVICE_ATTACHED) and <meta-data> .<meta-data> points to an xml file which contains vendor-id,produt-id,class,subclass,protocol.
  • to give information <usb-device> tag can be used.
<manifest ...>
<uses-feature android:name="android.hardware.usb.host" />
<uses-sdk android:minSdkVersion="12" />
...
<application>
<activity ...>
...
<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/xml_file_name" />
</activity>
</application>
</manifest>

android.hardware.usb package

USB host API’s in the android.hardware.usb

Leave a Reply

Top
%d bloggers like this: