I want to use the UsbManager
API by wrote following code:
In the Activity code:
UsbManager manager = (UsbManager) getSystemService(Context.USB_SERVICE);
HashMap<String, UsbDevice> deviceList = manager.getDeviceList();
Log.d(TAG, "size =" + deviceList.size());
In the Manifest:
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="17" />
<permission android:name="android.hardware.usb.host" >
</permission>
<uses-feature android:name="android.hardware.usb.host" android:required="true" />
I also followed this question, checked my Galaxy SII 9100G. It does have /system/etc/permissions/android.hardware.usb.host.xml
, and the right permissions.
But manager.getDeviceList()
always return zero, when I tried flash-driver and mouse.
Can anyone give me any suggestion?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…