Code example for UsbDevice

Methods: getProductId, getVendorId

0
                if (!ACTION_USB_PERMISSION.equals(intent.getAction())) {
                    listener.onException(new IOException("No permission to access USB device."));
                    return; 
                } 
 
                listener.onBind(device.getVendorId(), device.getProductId(), new AndroidDriverBinding(manager, device));
            } 
        }, new IntentFilter(ACTION_USB_PERMISSION));
 
        manager.requestPermission(device, PendingIntent.getBroadcast(context, 0, new Intent(ACTION_USB_PERMISSION), 0));
    } 
 
    private final UsbManager manager;
    private final UsbDevice device;
 
    private transient UsbDeviceConnection conn;
 
    public AndroidDriverBinding(UsbManager manager, UsbDevice device) {
        this.manager = manager;
        this.device = device;
    }