Receiving data from Arduino to Android Device via USB

I am trying to receive data from Arduino to my Android device. I started from here In the activity part of the application, they did

public void onProgressChanged(SeekBar seekBar, int progress,
boolean fromUser) {
if(sUsbController != null){

In the send function

public void send(byte data) {
    mData = data;
    synchronized (sSendLock) {

And in the UsbRunnable part

private class UsbRunnable implements Runnable {
    private final UsbDevice mDevice;

    UsbRunnable(UsbDevice dev) {
        mDevice = dev;

    public void run() {//here the main USB functionality is implemented
        UsbDeviceConnection conn = mUsbManager.openDevice(mDevice);
        if (!conn.claimInterface(mDevice.getInterface(1), true)) {
        // Arduino Serial usb Conv
        conn.controlTransfer(0x21, 34, 0, 0, null, 0, 0);
        conn.controlTransfer(0x21, 32, 0, 0, new byte[] { (byte) 0x80,
                0x25, 0x00, 0x00, 0x00, 0x00, 0x08 }, 7, 0);

conn.bulkTransfer(epOUT, new byte[] { mData }, 1, 0);

So, App took the progress of the seekbar and sent it to the Arduino. But, I want my app to receive data from Arduino. I guess I need to use bulktransfer function as well. think that I want to save the data to mData variable. How can I do that?

check the data coming from arduino to android via USB host

My code receive data on my Android phone from Arduino via USB host. The data (in form of bytes) is transformed to String Output, I write code in the method updateReceivedData(byte[]) that checks if th

What is the best method for receiving data from sensors through arduino board to android device?

I am developing one application for android which receives data from 13 different sensors through arduino adk board and display it on android device.I followed example of demokit but I have fear that

Android – Receiving strange bits from Arduino via Bluetooth

I am writing software for Android for communication between Arduino and Android. The Arduino sends data using serial.println – I send the text It works!. The Android is receiving data in this way: b

Sending data from PC to Android via USB

What would be the best option to send data from a laptop to a USB accessory incompatible Android powered device, in order to interface an Arduino with an Android phone? Can socket programming be the o

Android – Reading data from health devices via USB

Does android support reading data from personal health device via USB?If so what are the drivers and interfaces required for developing the same?

Arduino Android and USB host API

I have a device linked to the serial port of an Arduino Uno. I need to link the Arduino to an Android smartphone via USB in order to read the data retrieved from the serial port. I was planning to use

How to save/retrieve data with android device sd-card, via USB Debugging mode?

Is there a way to save/retrieve files from an android device, via the USB debugging mode. That means I want my application to get connected even if the Device is charging via the USB cable connected t

Android USB HID Device

Does anyone know how to configure an Android device (tablet) to appear as a USB HID device when connected to a PC? Is there any other way of getting data from the tablet to the PC (via USB) other than

Communicating with Arduino from Android

i’m trying to communicate with Arduino board (Duemilanove) from Android 3.1 device with USB-host support using Android USB Host API. The goal is to communicate with the board in the same way as via Se

Send Data From Arduino to Android App via Bluetooth

Hello i can send data from android to arduino but i cant send data from arduino to android via Bluetooth on procesing i dont get any Error but I cant see anything on display of android app.. i used fo


Using the bulkTransfer method is the way to go. You will need to use the IN endpoint to receive the data. For instance, to get a byte of data from the Arduino use this:

byte[] reply = new byte[1]; // to store data from Arduino
int size = 1;               // receive at most 1 byte of data
int timeout = 100;          // try to receive data for up to 100 milliseconds
int count = conn.bulkTransfer(epIN, reply, size, timeout);

if(count < 0) {
    Log.d("ArduinoUSB", "Failure occurred when receiving from Arduino");
} else {
    Log.d("ArduinoUSB", "Received " + count + " bytes: " + Arrays.toString(reply));

The data will be stored in reply.