Reputation: 2897
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 ?
Upvotes: 3
Views: 2883
Reputation: 4232
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);
Upvotes: 6