Udi
Udi

Reputation: 11

USB Class on android

Where is the USB class support implemented in Android devices, is it on the ANDROID version, or the chipset level?

In other words if I want to know if a specific smartphone supports for example UVC class, would I need to check the chipset or the Android version to know the answer to this?

Upvotes: 1

Views: 899

Answers (1)

Muhammad Farhan Habib
Muhammad Farhan Habib

Reputation: 1809

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).

Upvotes: 1

Related Questions