How to check whether Android device supports OTG features programatically

蹲街弑〆低调 提交于 2019-12-10 18:10:00

问题


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 ?


回答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);


来源:https://stackoverflow.com/questions/32116245/how-to-check-whether-android-device-supports-otg-features-programatically

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!