How do I get an app to read data from a USB barcode reader if the 
usbManager can't even detect that its there.

On Thursday, September 19, 2013 3:55:19 PM UTC-4, eli wrote:

>    <http://stackoverflow.com/questions/18900666/android-usb-problems#> 
> **
>   
> I have a tablet, an OTG cable and a barcode reader. I know this works 
> because when I start the Google app I can scan barcodes and see them on the 
> screen.
>
> I created a very simple application that starts the USB manager and checks 
> how many devices are attached.
>
> When I have a memory flash stick in the OTG cable the program shows 1. 
> (correct) 
>
> When I have a mouse in the OTG cable it shows 0. (why)
>
> Interesting observation. When I connect the mouse to the OTG cable it 
> works fine. I use it to click on the button to ask the usbManager how many 
> devices are attached and the response is 0.
>
>  When I attach a barcode reader to the OTG cable, the application goes 
> through onDestroy() and then shows 0. (Why does this happen)
>
> Basics of my program developed using Eclipse:
>
> In onCreate() I have:
>
> usbManager = (UsbManager)getSystemService(Context.USB_SERVICE);
>
>  
>
> In onClick() I have              (there is a button on the screen):
>
> Map<String, UsbDevice> usbDeviceList = 
> sbManager.getDeviceList();Toast.makeText(this, String.format("Number of 
> devices = %d", usbDeviceList.size()), Toast.LENGTH_SHORT).show();
>
>

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to