The official way to determine if the device has USB host capability is to use the associated system feature.
Ideally, add a <uses-feature>
element to your manifest, indicating that you are interested in the android.hardware.usb.host
feature. If you do not absolutely need that feature, add android:required="false"
as an attribute.
If you went with android:required="false"
, and you want to determine whether the device is a USB host at runtime, use PackageManager
, hasSystemFeature()
, and FEATURE_USB_HOST
. FEATURE_USB_HOST
is defined as the same string as you would be using in <uses-feature> (android.hardware.usb.host)
.