首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >安卓usb设备列表

安卓usb设备列表
EN

Stack Overflow用户
提问于 2013-07-31 23:54:07
回答 1查看 2.6K关注 0票数 2

我尝试列出所有连接到我的android平板电脑上的usb设备。我使用https://play.google.com/store/apps/details?id=hu.sztupy.android.usbhostcontroller&hl=en来检查设备是否能识别use键盘,是的,它在两个平板电脑上都能识别,而且tastatur在两个平板电脑上都能工作。代码看起来像这样

代码语言:javascript
复制
  UsbManager mUsbManager;
     mUsbManager = (UsbManager) getSystemService(Context.USB_SERVICE);
        mUsbManager.getDeviceList();  
        HashMap<String, UsbDevice> deviceList = mUsbManager.getDeviceList(); 
        Iterator<UsbDevice> deviceIterator = deviceList.values().iterator();
        this.outputtext.append(deviceList.size()+"Geräte gefunden");
        this.outputtext.append(mUsbManager.toString());
        UsbDevice device=null;       
 while(deviceIterator.hasNext()){
            device = deviceIterator.next();  
            this.outputtext.append( device.getDeviceName()+" vendorid: "+device.getVendorId()+"  productid"+device.getProductId());
}

奇怪的是,它在我的爱可思钛hd上工作,但在我的富士通m532上不起作用。我做错了什么?

诚挚的问候

EN

回答 1

Stack Overflow用户

发布于 2017-11-02 18:00:32

只需检查您的富士通m532的API级别,因为getSystemService()要求最低API级别为23 (Android版本6.0)。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/17975122

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档