2016-09-27 100 views
0

我試圖創建一個可以檢測到USB設備的應用程序。 Android設備就像一個主機,我現在只需要讀取連接設備的數據。問題在Android中獲取USB設備版本

我導入android.hardware.usb.UsbDevice

所有工作正常,但問題是任何usbDevice方法。我可以讀取usbDevice.getDeviceName()方法,但我不能使用例如getVersion(),whY?

他說我cannos解決這個方法。還有關於其他方法。

private String readDevice(UsbDevice device) { 

     StringBuilder sb = new StringBuilder(); 
     String a = device.getDeviceName(); //work 
     String b = device.getVersion(); //doesn't work 

} 

回答

1

您需要閱讀This Link

它包含在API 23

String versionStr = UsbDevice.getVersion(); 

或者你可以幫助從This Link