W
W
Walik2013-03-03 20:06:28
Android
Walik, 2013-03-03 20:06:28

Working with external USB devices in an Android application?

Hello.
I would like to ask a couple of questions about working with devices connected via USB.
At the moment, there is no android device at hand. Is there any way to test it in the emulator? For example, connect a device to a computer, will the emulator see it?
Tried like this:

manager = (UsbManager) getSystemService(Context.USB_SERVICE);
HashMap<String, UsbDevice> deviceList = manager.getDeviceList();
Iterator<UsbDevice> deviceIterator = deviceList.values().iterator();
        
while(deviceIterator.hasNext()) {
          device = deviceIterator.next();
        	
          Log.d(TAG, "### device: " + device.toString());
}

For example, I have a mouse connected via usb, but the logs are empty.
Here's the question: Is it possible to work with USB devices in the emulator?
And there is also another question, how can some device be emulated during development?
That is, for example, there is no real device at hand yet (there will be a printer), with which the tablet will have to work.
Maybe I didn’t write everything clearly, if you ask anything, I’ll clarify what I meant in the question))
Thank you)

Answer the question

In order to leave comments, you need to log in

2 answer(s)
@
@ntkt, 2013-03-03
_

Try Android x86, which is under Wirth. machine (virtualbox, for example). There should be more transparent with device forwarding

C
chuck, 2016-12-19
@chuck

The Genymotion emulator can work with USB.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question