Skip to content Skip to sidebar Skip to footer

How To Check Whether Android Device Supports Otg Features Programatically

I want to check whether a device supports OTG features programatically . I have tried a lot about this in Internet but could not find any thing . How can I do that ?

Solution 1:

thnx to @CommonsWare: How to detect if Android has full USB support or not?

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.

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

in code words:

context.getPackageManager().hasSystemFeature(PackageManager.FEATURE_USB_HOST);

Post a Comment for "How To Check Whether Android Device Supports Otg Features Programatically"