• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Apps Receive USB Device Input

ewebfoot

Lurker
Hello everyone,

I am developing an application in Android 3.0

I have plugged a barcode scanner into my Acer a501 Tablet and it works sweet. If I select an EditText box, scan an item, the barcode ID shows up inside that box, just a like a keyboard input.

However, I have a slightly more complicated use. I do not want to print the barcode ID into a EditText box but capture the data and store it into a variable anytime the barcode scanner scans something.

How do I directly connect to the USB device? Is there a listening function so as soon as the barcode scanner scans something I can capture the results?

I really appreciate the support!
 
Welcome to AF!

I dont really know much about USB host mode yet, but I can suggest some ideas that I hope are helpful.

First, maybe have a look in LogCat and see if there are clues there about an event/intent.

Second, a workaround could be something along the lines of creating an invisible EditText, and grabbing the value from there.

EditText has listeners for when the text has changed so you could maybe listen to that. It's a bit of a hack, but if it works, you can use it until you find the real intent/listener/callback that you want.
 
Thanks for your response!

I am a beginner at Android development and unfortunately there doesn't seem to be many resources or information out there about Androids USB Interface.

Is there a company or independent developer you would recommend we could hire to help us build the USB Interface?

Cheers,
Chris
 
Back
Top Bottom