Take the 2-minute tour ×

I connect two USB devices to my Android 3.1 tabled and I try to iterate over all of them and request the permission for each:

UsbManager mManager = (UsbManager) context.getSystemService(Context.USB_SERVICE);
for (UsbDevice device :  mManager.getDeviceList().values()) {
  mManager.requestPermission(device, mPermissionIntent);

The issue is that only one permission screen appears instead of two and I suspect requestPermission causing this. Are there any workarounds in Android for that?

share|improve this question
Maybe this question will be able to help you stackoverflow.com/questions/13299393/getdevicelist-always-empty –  Boardy Jan 14 '13 at 11:54
I am able to iterate through the devices, the issue is that only one of them show the permission screen. –  Alin Jan 14 '13 at 19:29

1 Answer 1

up vote 1 down vote accepted

My workaround is, if there are multiple permission requests to be issued, issue one at a time. That is, after the receiver has got the response to the first permission request, issue the next request. I tested this workaround last night, and it solved the missing permission screen and missing response problem. I am using Android 4.x.

share|improve this answer
how did you implemented that? using java synchronization? –  Alin Jan 29 '13 at 9:09
In Activity.onCreate(), I get a list of USB devices and put them in a collection. Then take one USB device from the collection and initiate a permission request. When the receiver receives the outcome of the permission request, it takes another USB device from the collection and initiates yet another permission request. This continues until there is no more USB device left in the collection. –  hwt Feb 2 '13 at 7:35

Your Answer


