How can I get the ID (or some unique properties) of the USB devices connected to my Android device programmatically?

How can I get the ID (or some unique properties) of the USB devices connected to my Android device?

+1


source to share


2 answers


You can get the unique ID of the connected Android enabled USB device using the UsbDevice.getDeviceId () method.

For more details, please see the links below. http://developer.android.com/reference/android/hardware/usb/UsbDevice.html#getDeviceId ()



More than an identifier, check out the other methods of the "UsbDevice" class. http://developer.android.com/reference/android/hardware/usb/UsbDevice.html

+2


source


For anyone familiar with the UsbDevice

use ofUsbManager

UsbManager usbManager = (UsbManager) getSystemService(Context.USB_SERVICE);
HashMap<String, UsbDevice> usbDevices = usbManager.getDeviceList();

      



More details at http://developer.android.com/reference/android/hardware/usb/UsbManager.html

+2


source







All Articles