How to read data from bluetooth barcode scanner Symbol CS3070 to Android Device How to read data from bluetooth barcode scanner Symbol CS3070 to Android Device android android

How to read data from bluetooth barcode scanner Symbol CS3070 to Android Device


I just received my device and when I paired and connected the device it automatically sends the data to the currently focused EditText. What version of Android are you using because I tried it on ICS and JB and it worked this way. I have not tested it in any earlier versions.

Edit:

I downgraded my phone to Gingerbread and found out it does not work the same way but I have a solution:

This is important! >> First you must scan the barcode in the manual that says "Serial Port Profile (SPP)".

btAdapter = BluetoothAdapter.getDefaultAdapter();if (btAdapter.isEnabled()){    new BluetoothConnect().execute("");}public class BluetoothConnect extends AsyncTask<String, String, Void>{    public static String MY_UUID = "00001101-0000-1000-8000-00805F9B34FB";    @Override    protected Void doInBackground(String... params)    {        String address = DB.GetOption("bluetoothAddress");        BluetoothDevice device = btAdapter.getRemoteDevice(address);        try        {            socket = device.createRfcommSocketToServiceRecord(UUID.fromString(MY_UUID));            btAdapter.cancelDiscovery();            socket.connect();            InputStream stream = socket.getInputStream();            int read = 0;            byte[] buffer = new byte[128];            do            {                try                {                    read = stream.read(buffer);                    String data = new String(buffer, 0, read);                    publishProgress(data);                }                catch(Exception ex)                {                    read = -1;                }            }            while (read > 0);        }        catch (IOException e)        {            e.printStackTrace();        }        return null;    }    @Override    protected void onProgressUpdate(String... values)    {        if (values[0].equals("\r"))        {            addToList(input.getText().toString());            pickupInput.setText("");        }        else input.setText(values[0]);        super.onProgressUpdate(values);    }}

This is an incomplete version of my working code but you should get the gist.
I hope this solution works for you as well!