{"id":5955,"date":"2020-04-30T16:57:51","date_gmt":"2020-04-30T11:27:51","guid":{"rendered":"https:\/\/www.innovationm.com\/blog\/?p=5955"},"modified":"2020-04-30T17:05:32","modified_gmt":"2020-04-30T11:35:32","slug":"how-to-use-android-bluetooth-api-for-basic-data-transfer-from-one-device-to-another-device","status":"publish","type":"post","link":"https:\/\/www.innovationm.com\/blog\/how-to-use-android-bluetooth-api-for-basic-data-transfer-from-one-device-to-another-device\/","title":{"rendered":"How To Use Android  Bluetooth API For Basic Data Transfer From One Device To Another Device"},"content":{"rendered":"<p><strong>Introduction:<\/strong><\/p>\n<p><strong>Bluetooth:<br \/>\n<\/strong><br \/>\nThe Android platform supports Bluetooth connection, which allows us to exchange data with other Bluetooth devices. The application framework provides Bluetooth related functionality through the Android Bluetooth APIs.All of the Bluetooth APIs are available in the Android Bluetooth package.<\/p>\n<p>There are two types of Bluetooth in Android Classic Bluetooth and Bluetooth devices with low power requirements. Android 4.3 (API level 18) introduces API support for Bluetooth Low EnergyBluetooth(BLE).<\/p>\n<p>Here we will only focus on Classic Bluetooth. Classic Bluetooth is the right choice for more battery-intensive operations, which include streaming and communicating between Android devices.<\/p>\n<p><strong>Steps to use Bluetooth in Android<\/strong><\/p>\n<p><strong>Step 1:<\/strong><\/p>\n<p>Bluetooth permissions &#8211;<\/p>\n<pre class=\"lang:xhtml decode:true\">&lt;manifest&gt;\r\n&lt;uses-permission android:name=\"android.permission.BLUETOOTH\" \/&gt;\r\n&lt;uses-permission android:name=\"android.permission.BLUETOOTH_ADMIN\" \/&gt;\r\n&lt;uses-permission android:name=\"android.permission.ACCESS_FINE_LOCATION\" \/&gt;\r\n&lt;\/manifest&gt;<\/pre>\n<p><strong>Note:<\/strong><\/p>\n<p><strong>1-<\/strong> If your app targets Android 9 (API level 28) or lower, you can declare the\u00a0 \u00a0 \u00a0 \u00a0\u00a0<strong>ACCESS_COARSE_LOCATION<\/strong> permission instead of the <strong>ACCESS_FINE_LOCATION<\/strong> permission.<br \/>\n<strong>2- ACCESS_FINE_LOCATION<\/strong> or <strong>ACCESS_FINE_LOCATION come<\/strong>s under the dangerous permissions so we need to define the runtime permission for these.<\/p>\n<p><strong>Step 2:<\/strong><\/p>\n<p>Set up Bluetooth and Scan for Available devices:-<\/p>\n<p>Now let\u2019s build our layout file. So open<strong> activity_bluetooth_device_list<\/strong> file and add the below code.<\/p>\n<pre class=\"lang:c++ decode:true\">&lt;?xml version=\"1.0\" encoding=\"utf-8\"?&gt;\r\n&lt;LinearLayout xmlns:android=\"http:\/\/schemas.android.com\/apk\/res\/android\"\r\n    xmlns:app=\"http:\/\/schemas.android.com\/apk\/res-auto\"\r\n    xmlns:tools=\"http:\/\/schemas.android.com\/tools\"\r\n    android:layout_width=\"match_parent\"\r\n    android:layout_height=\"match_parent\"\r\n    android:orientation=\"vertical\"\r\n    tools:context=\".BluetoothDeviceListActivity\"&gt;\r\n\r\n    &lt;Button\r\n        android:id=\"@+id\/scanBtn\"\r\n        android:layout_width=\"match_parent\"\r\n        android:layout_height=\"wrap_content\"\r\n        android:layout_margin=\"20dp\"\r\n        android:gravity=\"center\"\r\n        android:text=\"Scan for Devices\"&gt;\r\n\r\n    &lt;\/Button&gt;\r\n\r\n    &lt;ListView\r\n        android:id=\"@+id\/lvNewDevices\"\r\n        android:layout_width=\"match_parent\"\r\n        android:layout_height=\"300dp\"\r\n        android:layout_margin=\"20dp\"\r\n        android:scrollbars=\"none\" \/&gt;\r\n\r\n    &lt;EditText\r\n        android:gravity=\"center\"\r\n        android:layout_gravity=\"center\"\r\n        android:hint=\"type messgae here..\"\r\n        android:id=\"@+id\/editText\"\r\n        android:layout_width=\"match_parent\"\r\n        android:layout_height=\"wrap_content\"\r\n        android:layout_margin=\"20dp\"&gt;&lt;\/EditText&gt;\r\n\r\n    &lt;Button\r\n        android:id=\"@+id\/sendBtn\"\r\n        android:layout_width=\"match_parent\"\r\n        android:layout_height=\"wrap_content\"\r\n        android:layout_margin=\"20dp\"\r\n        android:gravity=\"center\"\r\n        android:text=\"send message\"\/&gt;\r\n\r\n&lt;\/LinearLayout&gt;\r\n<\/pre>\n<p><strong>Step 3:<\/strong><\/p>\n<p>Now in the<strong> BluetoothDeviceListActivity<\/strong>, add these below code:<\/p>\n<pre class=\"lang:xhtml decode:true\">import android.app.Activity;\r\nimport android.bluetooth.BluetoothAdapter;\r\nimport android.bluetooth.BluetoothDevice;\r\nimport android.bluetooth.BluetoothManager;\r\nimport android.content.BroadcastReceiver;\r\nimport android.content.Context;\r\nimport android.content.Intent;\r\nimport android.content.IntentFilter;\r\nimport android.content.pm.PackageManager;\r\nimport android.os.Build;\r\nimport android.support.annotation.NonNull;\r\nimport android.support.annotation.Nullable;\r\nimport android.support.v4.app.ActivityCompat;\r\nimport android.support.v4.content.ContextCompat;\r\nimport android.support.v7.app.AppCompatActivity;\r\nimport android.os.Bundle;\r\nimport android.util.Log;\r\nimport android.view.View;\r\nimport android.widget.AdapterView;\r\nimport android.widget.Button;\r\nimport android.widget.EditText;\r\nimport android.widget.ListView;\r\nimport android.widget.Toast;\r\n\r\nimport java.util.ArrayList;\r\n\r\npublic class BluetoothDeviceListActivity extends AppCompatActivity implements View.OnClickListener, AdapterView.OnItemClickListener {\r\n\r\n    final String[] permissions = {\"android.permission.ACCESS_COARSE_LOCATION\", \"android.permission.ACCESS_FINE_LOCATION\"};\r\n    private ArrayList&lt;BluetoothDevice&gt; mBTDevices;\r\n    private static final int ENABLE_REQUEST_CODE = 8989;\r\n    private DeviceListAdapter mDeviceListAdapter;\r\n    private BluetoothManager bluetoothManager;\r\n    private BluetoothAdapter bluetoothAdapter;\r\n    private Button scanBtn;\r\n    private ListView lvNewDevices;\r\n    private BluetoothBroadCoast bluetoothBroadCoast;\r\n    private String TAG = getClass().getName();\r\n    private boolean isScanButtonClicked;\r\n    private BluetoothDevice mBTDevice;\r\n    private BluetoothConnectionService bluetoothServiceConnection;\r\n    private EditText editText;\r\n    private Button sendBtn;\r\n\r\n    @Override\r\n    protected void onCreate(Bundle savedInstanceState) {\r\n        super.onCreate(savedInstanceState);\r\n        setContentView(R.layout.activity_bluetooth_device_list);\r\n        inItView();\r\n\r\n\r\n        checksPermission();\r\n    }\r\n\r\n    private void inItView() {\r\n\r\n        scanBtn = findViewById(R.id.scanBtn);\r\n        sendBtn = findViewById(R.id.sendBtn);\r\n        editText = findViewById(R.id.editText);\r\n        scanBtn.setOnClickListener(this);\r\n        sendBtn.setOnClickListener(this);\r\n        lvNewDevices = (ListView) findViewById(R.id.lvNewDevices);\r\n        mBTDevices = new ArrayList&lt;&gt;();\r\n        mDeviceListAdapter = new DeviceListAdapter(this, R.layout.device_adapter_view, mBTDevices);\r\n        lvNewDevices.setOnItemClickListener(this);\r\n        lvNewDevices.setAdapter(mDeviceListAdapter);\r\n    }\r\n\r\n    @Override\r\n    protected void onResume() {\r\n        super.onResume();\r\n\r\n        registerBluetoothBroadcast();\r\n    }\r\n\r\n    @Override\r\n    protected void onPause() {\r\n        super.onPause();\r\n        unregisterReceiver(bluetoothBroadCoast);\r\n    }\r\n\r\n\r\n    \/**\r\n     * different  set of BroadCast Receivers  for different bluetooth  operations\r\n     *\/\r\n\r\n    private void registerBluetoothBroadcast() {\r\n\r\n        bluetoothBroadCoast = new BluetoothBroadCoast();\r\n        IntentFilter intentFilter = new IntentFilter();\r\n        intentFilter.addAction(BluetoothDevice.ACTION_FOUND);\r\n        intentFilter.addAction(BluetoothDevice.ACTION_BOND_STATE_CHANGED);\r\n        intentFilter.addAction(BluetoothAdapter.ACTION_STATE_CHANGED);\r\n        intentFilter.addAction(BluetoothDevice.ACTION_ACL_CONNECTED);\r\n        intentFilter.addAction(BluetoothDevice.ACTION_ACL_DISCONNECTED);\r\n        intentFilter.addAction(BluetoothAdapter.ACTION_SCAN_MODE_CHANGED);\r\n        intentFilter.addAction(BluetoothAdapter.ACTION_DISCOVERY_STARTED);\r\n        intentFilter.addAction(BluetoothAdapter.ACTION_DISCOVERY_FINISHED);\r\n        registerReceiver(bluetoothBroadCoast, intentFilter);\r\n    }\r\n\r\n    \/**\r\n     * checking run time permission for location\r\n     *\/\r\n    private void checksPermission() {\r\n        if (!hasPermission()) {\r\n            ActivityCompat.requestPermissions(this, permissions, 2001);\r\n        } else {\r\n            \/\/ if  permission granted check for check for bluetooth connection\r\n            setupBlueTooth();\r\n        }\r\n    }\r\n\r\n    private boolean hasPermission() {\r\n        for (int i = 0; i &lt; permissions.length; i++) {\r\n            if (ContextCompat.checkSelfPermission(this, permissions[i]) != PackageManager.PERMISSION_GRANTED) {\r\n                return false;\r\n            }\r\n        }\r\n        return true;\r\n    }\r\n\r\n\r\n    public void setupBlueTooth() {\r\n        bluetoothManager = (BluetoothManager) getSystemService(Context.BLUETOOTH_SERVICE);\r\n        if (bluetoothManager != null) {\r\n            bluetoothAdapter = bluetoothManager.getAdapter();\r\n            bluetoothServiceConnection = new BluetoothConnectionService(this);\r\n\r\n        }\r\n        if (!bluetoothAdapter.isEnabled()) {\r\n\r\n        }\r\n        enableBluetooth();\r\n    }\r\n\r\n    \/\/ enable the bluetooth...\r\n    public void enableBluetooth() {\r\n        Intent intent = new Intent(BluetoothAdapter.ACTION_REQUEST_ENABLE);\r\n        startActivityForResult(intent, ENABLE_REQUEST_CODE);\r\n    }\r\n\r\n\r\n    @Override\r\n    protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {\r\n        super.onActivityResult(requestCode, resultCode, data);\r\n        if (requestCode == ENABLE_REQUEST_CODE) {\r\n            if (resultCode == RESULT_OK) {\r\n                if (isScanButtonClicked) {\r\n                    mBTDevices.clear();\r\n                    bluetoothAdapter.startDiscovery();\r\n                }\r\n            }\r\n        }\r\n\r\n    }\r\n\r\n    @Override\r\n    public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions,\r\n                                           @NonNull int[] grantResults) {\r\n        switch (requestCode) {\r\n            case 2001: {\r\n                setupBlueTooth();\r\n                break;\r\n            }\r\n        }\r\n    }\r\n\r\n    @Override\r\n    public void onClick(View view) {\r\n        if (view.getId() == R.id.scanBtn) {\r\n            isScanButtonClicked = true;\r\n            mBTDevices.clear();\r\n            mDeviceListAdapter.notifyDataSetChanged();\r\n\r\n            if (!bluetoothAdapter.isEnabled()) {\r\n                enableBluetooth();\r\n            } else {\r\n                if (!bluetoothAdapter.isDiscovering()) {\r\n                    bluetoothAdapter.cancelDiscovery();\r\n                    bluetoothAdapter.startDiscovery();\r\n                }\r\n            }\r\n        }else if (view.getId()==R.id.sendBtn){\r\n            bluetoothServiceConnection.write(editText.getText().toString().getBytes());\r\n        }\r\n    }\r\n\r\n    @Override\r\n    public void onItemClick(AdapterView&lt;?&gt; adapterView, View view, int i, long l) {\r\n\r\n        \/\/first cancel discovery because its very memory intensive.\r\n        bluetoothAdapter.cancelDiscovery();\r\n\r\n        String deviceName = mBTDevices.get(i).getName();\r\n        String deviceAddress = mBTDevices.get(i).getAddress();\r\n\r\n\r\n        \/\/create the bond.\r\n\r\n        if (Build.VERSION.SDK_INT &gt; Build.VERSION_CODES.JELLY_BEAN_MR2) {\r\n            Log.d(TAG, \"Trying to pair with \" + deviceName);\r\n\r\n            mBTDevices.get(i).createBond();\r\n            mBTDevice = mBTDevices.get(i);\r\n\r\n        }\r\n\r\n    }\r\n\r\n\r\n    class BluetoothBroadCoast extends BroadcastReceiver {\r\n        @Override\r\n        public void onReceive(Context context, Intent intent) {\r\n            final String action = intent.getAction();\r\n            \/\/  Broadcast for finding bluetooth device... Most Important Broadcast receiver...\r\n            if (action != null &amp;&amp; action.equals(BluetoothDevice.ACTION_FOUND)) {\r\n                BluetoothDevice device = intent.getParcelableExtra(BluetoothDevice.EXTRA_DEVICE);\r\n                \/\/ Add new Found Bluetooth device..\r\n                Log.i(\"BT\", device.getName() + \"\\n\" + device.getAddress());\r\n                if (mBTDevices != null &amp;&amp; !mBTDevices.contains(device)) {\r\n                    mBTDevices.add(device);\r\n                }\r\n                Log.d(TAG, \"device found\");\r\n\r\n                mDeviceListAdapter.notifyDataSetChanged();\r\n            }\r\n            \/\/Broadcast for starting discoverying other bluetooth device...\r\n            else if (action.equals(BluetoothAdapter.ACTION_DISCOVERY_STARTED)) {\r\n                Log.d(TAG, \"mBroadcastReceiver: Discovery Started.\");\r\n\r\n            }\r\n            \/\/ Broadcast for canceling discovery device...\r\n            else if (action.equals(BluetoothAdapter.ACTION_DISCOVERY_FINISHED)) {\r\n                Log.d(TAG, \"mBroadcastReceiver: Discovery Finished.\");\r\n                \/\/BluetoothConnectionManager.getInstance().checkBluetoothDevice();\r\n            }\/\/ Pairing or bonding Broadcast for device...\r\n            else if (action.equals(BluetoothDevice.ACTION_BOND_STATE_CHANGED)) {\r\n                BluetoothDevice mDevice = intent.getParcelableExtra(BluetoothDevice.EXTRA_DEVICE);\r\n                \/\/3 cases:\r\n                \/\/case1: this case is for bonded already and this save connected device\r\n                \/\/ and start Bluetooth connection to paired device...\r\n                if (mDevice.getBondState() == BluetoothDevice.BOND_BONDED) {\r\n                    Log.d(TAG, \"BroadcastReceiver: BOND_BONDED.\");\r\n\r\n                    bluetoothServiceConnection.startClient(mDevice, BluetoothConnectionService.MY_UUID_INSECURE);\r\n\r\n\r\n                }\r\n                \/\/case2: creating a bone\r\n                if (mDevice.getBondState() == BluetoothDevice.BOND_BONDING) {\r\n                    Log.d(TAG, \"BroadcastReceiver: BOND_BONDING.\");\r\n                }\r\n                \/\/case3: breaking a bond\r\n                if (mDevice.getBondState() == BluetoothDevice.BOND_NONE) {\r\n                    Log.d(TAG, \"BroadcastReceiver: BOND_NONE.\");\r\n                }\r\n            }\r\n            \/\/ This broadcast fires when other device is connected...\r\n            else if (action.equals(BluetoothDevice.ACTION_ACL_CONNECTED)) {\r\n                Log.d(TAG, \"mBroadcastReceiver4: Connected.\");\r\n                Toast.makeText(BluetoothDeviceListActivity.this, \"connected to device\", Toast.LENGTH_SHORT).show();\r\n            }\r\n            \/\/ This broadcast fired when other device is disconnected...\r\n            else if (action.equals(BluetoothDevice.ACTION_ACL_DISCONNECTED)) {\r\n                Log.d(TAG, \"mBroadcastReceiver4: Disconnected.\");\r\n                Toast.makeText(BluetoothDeviceListActivity.this, \"disconnected to device\", Toast.LENGTH_SHORT).show();\r\n\r\n            }\r\n\r\n\r\n        }\r\n    }\r\n}\r\n<\/pre>\n<p><strong>Step 4:<\/strong><\/p>\n<p>Now add these code in class <strong>BluetoothConnectionService<\/strong><\/p>\n<pre class=\"lang:xhtml decode:true\">import android.app.Activity;\r\nimport android.app.ProgressDialog;\r\nimport android.bluetooth.BluetoothAdapter;\r\nimport android.bluetooth.BluetoothDevice;\r\nimport android.bluetooth.BluetoothServerSocket;\r\nimport android.bluetooth.BluetoothSocket;\r\nimport android.content.Context;\r\nimport android.util.Log;\r\nimport android.widget.Toast;\r\nimport java.io.IOException;\r\nimport java.io.InputStream;\r\nimport java.io.OutputStream;\r\nimport java.nio.charset.Charset;\r\nimport java.util.UUID;\r\n\r\npublic class BluetoothConnectionService {\r\n\r\n    private static final String TAG = \"BluetoothConnectionServ\";\r\n\r\n    private static final String appName = \"BLEDEMO\";\r\n\r\n    public static final UUID MY_UUID_INSECURE = UUID.fromString(\"00001101-0000-1000-8000-00805F9B34FB\");\r\n    \/\/        private static final UUID MY_UUID_INSECURE = UUID.fromString(\"8ce255c0-200a-11e0-ac64-0800200c9a66\");\r\n    private AcceptThread mAcceptThread;\r\n    private ConnectThread mConnectThread;\r\n    private BluetoothDevice mmDevices;\r\n    private UUID deviceUUID;\r\n    ProgressDialog progressDialog;\r\n    private ConnectedThread mConnectedThread;\r\n\r\n    private final BluetoothAdapter mBluetoothAdapter;\r\n    Context context;\r\n\r\n    public BluetoothConnectionService(Context context) {\r\n        this.context = context;\r\n        this.mBluetoothAdapter = BluetoothAdapter.getDefaultAdapter();\r\n        start();\r\n    }\r\n\r\n    private class AcceptThread extends Thread {\r\n        private final BluetoothServerSocket mmServerSocket;\r\n\r\n        public AcceptThread() {\r\n            BluetoothServerSocket tmp = null;\r\n            try {\r\n                tmp = mBluetoothAdapter.listenUsingRfcommWithServiceRecord(appName, MY_UUID_INSECURE);\r\n                Log.d(TAG, \"AcceptThread: Setting up using: \" + MY_UUID_INSECURE);\r\n            } catch (IOException e) {\r\n                e.printStackTrace();\r\n            }\r\n\r\n            mmServerSocket = tmp;\r\n\r\n        }\r\n\r\n        public void run() {\r\n            Log.d(TAG, \"run: AcceptThread Running.\");\r\n\r\n            BluetoothSocket socket = null;\r\n\r\n            try {\r\n                Log.d(TAG, \"run: RFCOM server socket start....\");\r\n\r\n                socket = mmServerSocket.accept();\r\n\r\n                Log.d(TAG, \"run: RFCOM server socket accepted connection.\");\r\n            } catch (IOException e) {\r\n                Log.e(TAG, \"AcceptThread: IOException: \" + e.getMessage());\r\n            }\r\n\r\n            if (socket != null) {\r\n                connected(socket, mmDevices);\r\n            }\r\n        }\r\n\r\n        public void cancel() {\r\n            Log.d(TAG, \"cancel: Canceling AcceptThread.\");\r\n            try {\r\n                mmServerSocket.close();\r\n            } catch (IOException e) {\r\n                Log.e(TAG, \"cancel: Close of AcceptThread ServerSocket failed. \" + e.getMessage());\r\n            }\r\n        }\r\n    }\r\n\r\n    private class ConnectThread extends Thread {\r\n        private BluetoothSocket mmSocket;\r\n\r\n        public ConnectThread(BluetoothDevice bluetoothDevice, UUID uuid) {\r\n            mmDevices = bluetoothDevice;\r\n            deviceUUID = uuid;\r\n\r\n            BluetoothSocket tmp = null;\r\n            Log.i(TAG, \"RUN: mConnectThread\");\r\n\r\n            try {\r\n                Log.d(TAG, \"ConnectThread: Trying to create InsecureRfcommSocket using UUID: \" + MY_UUID_INSECURE);\r\n\r\n                tmp = bluetoothDevice.createRfcommSocketToServiceRecord(deviceUUID);\r\n            } catch (IOException e) {\r\n                Log.e(TAG, \"ConnectThread: Could not create InsecureRfcommSocket\" + e.getMessage());\r\n            }\r\n\r\n            mmSocket = tmp;\r\n        }\r\n\r\n        public void run() {\r\n\r\n            mBluetoothAdapter.cancelDiscovery();\r\n\r\n            try {\r\n                mmSocket.connect();\r\n                Log.d(TAG, \"run: ConnectThread Connected.\");\r\n                if (mmSocket != null) {\r\n                    connected(mmSocket, mmDevices);\r\n                }\r\n            } catch (final IOException e) {\r\n                \/*try {\r\n                    mmSocket.close();\r\n                    Log.d(TAG, \"run: Closed Socket.\");\r\n                } catch (IOException ex) {\r\n                    Log.e(TAG, \"mConnectThread: run: Unable to close connection in socket.\" + ex.getMessage());\r\n                }*\/\r\n                Log.e(TAG, \"run: ConnectThread: Could not connect ot UUId: \" + MY_UUID_INSECURE);\r\n                ((Activity) context).runOnUiThread(new Runnable() {\r\n                    @Override\r\n                    public void run() {\r\n\r\n                        Toast.makeText(context, \"something went wrong\", Toast.LENGTH_SHORT).show();\r\n                    }\r\n                });\r\n            }\r\n\r\n\r\n        }\r\n\r\n        public void cancel() {\r\n            try {\r\n                Log.d(TAG, \"cancel: Closing client Socket\");\r\n                mmSocket.close();\r\n            } catch (IOException e) {\r\n                Log.e(TAG, \"cancel: close() of mmsocket in ConnectThread failed. \" + e.getMessage());\r\n            }\r\n        }\r\n    }\r\n\r\n    public synchronized void start() {\r\n        Log.d(TAG, \"start\");\r\n\r\n        if (mConnectThread != null) {\r\n            mConnectThread.cancel();\r\n            mConnectThread = null;\r\n        }\r\n        if (mAcceptThread == null) {\r\n            mAcceptThread = new AcceptThread();\r\n            mAcceptThread.start();\r\n        }\r\n    }\r\n\r\n    public void startClient(BluetoothDevice device, UUID uuid) {\r\n        Log.d(TAG, \"startClient: Started\");\r\n\r\n\/\/        progressDialog = ProgressDialog.show(context, \"Connecting bluetooth\", \"Please wait....\", true);\r\n        mConnectThread = new ConnectThread(device, uuid);\r\n        mConnectThread.start();\r\n    }\r\n\r\n    \/* this thread will connected to device by bluetooth and\r\n        receive data from other bluetooth device...*\/\r\n    private class ConnectedThread extends Thread {\r\n        private final BluetoothSocket mmSocket;\r\n        private final InputStream inputStream;\r\n        private final OutputStream outputStream;\r\n\r\n        public ConnectedThread(BluetoothSocket socket) {\r\n            Log.d(TAG, \"ConnectedThread: Starting\");\r\n            mmSocket = socket;\r\n            InputStream tmpIn = null;\r\n            OutputStream tmpOut = null;\r\n\r\n            \/*try {\r\n                progressDialog.dismiss();\r\n            } catch (NullPointerException e) {\r\n                e.printStackTrace();\r\n            }*\/\r\n            try {\r\n                tmpIn = mmSocket.getInputStream();\r\n                tmpOut = mmSocket.getOutputStream();\r\n\r\n            } catch (IOException e) {\r\n                e.printStackTrace();\r\n            }\r\n\r\n            inputStream = tmpIn;\r\n            outputStream = tmpOut;\r\n        }\r\n\r\n        public void run() {\r\n            byte[] buffer = new byte[1024];\r\n\r\n            int bytes;\r\n\r\n            while (true) {\r\n                try {\r\n                    bytes = inputStream.read(buffer);\r\n                    \/\/ this is incoming message...\r\n                    final String incomingMessage = new String(buffer, 0, bytes);\r\n                    ((Activity) context).runOnUiThread(new Runnable() {\r\n                        @Override\r\n                        public void run() {\r\n\r\n\r\n                            Toast.makeText(context, incomingMessage, Toast.LENGTH_SHORT).show();\r\n                        }\r\n                    });\r\n                    Log.d(TAG, \"InputStream: \" + incomingMessage);\r\n                } catch (IOException e) {\r\n                    Log.e(TAG, \"write: Error reading inputStream. \" + e.getMessage());\r\n                    break;\r\n                }\r\n            }\r\n        }\r\n\r\n        public void write(byte[] bytes) {\r\n            String text = new String(bytes, Charset.defaultCharset());\r\n            Log.d(TAG, \"write: Writing to Output Stream: \" + text);\r\n            try {\r\n                outputStream.write(bytes);\r\n            } catch (IOException e) {\r\n                Log.e(TAG, \"write: Error writing to outputStream. \" + e.getMessage());\r\n            }\r\n        }\r\n\r\n        public void cancel() {\r\n            try {\r\n                mmSocket.close();\r\n            } catch (IOException e) {\r\n\r\n            }\r\n        }\r\n    }\r\n\r\n    private void connected(BluetoothSocket mmSocket, BluetoothDevice mmDevices) {\r\n        Log.d(TAG, \"connected: Starting\");\r\n\r\n        mConnectedThread = new ConnectedThread(mmSocket);\r\n        mConnectedThread.start();\r\n    }\r\n\r\n    public void write(byte[] out) {\r\n        Log.d(TAG, \"write: Write Called.\");\r\n\r\n        mConnectedThread.write(out);\r\n    }\r\n}<\/pre>\n<p><strong>Step 5:<\/strong><\/p>\n<p>Now add these code in <strong>DeviceListAdapter<\/strong> for listing Bluetooth devices<\/p>\n<pre class=\"lang:xhtml decode:true\">import android.bluetooth.BluetoothDevice;\r\nimport android.content.Context;\r\nimport android.view.LayoutInflater;\r\nimport android.view.View;\r\nimport android.view.ViewGroup;\r\nimport android.widget.ArrayAdapter;\r\nimport android.widget.ListView;\r\nimport android.widget.TextView;\r\nimport java.util.ArrayList;\r\n\r\n\r\npublic class DeviceListAdapter extends ArrayAdapter&lt;BluetoothDevice&gt; {\r\n\r\n    private LayoutInflater mLayoutInflater;\r\n    private ArrayList&lt;BluetoothDevice&gt; mDevices;\r\n    private int mViewResourceId;\r\n    private ListView lvNewDevices;\r\n\r\n\r\n    public DeviceListAdapter(Context context, int tvResourceId, ArrayList&lt;BluetoothDevice&gt; devices) {\r\n        super(context, tvResourceId, devices);\r\n        this.mDevices = devices;\r\n        mLayoutInflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);\r\n        mViewResourceId = tvResourceId;\r\n    }\r\n\r\n    public View getView(int position, View convertView, ViewGroup parent) {\r\n        convertView = mLayoutInflater.inflate(mViewResourceId, null);\r\n\r\n        BluetoothDevice device = mDevices.get(position);\r\n\r\n        if (device != null) {\r\n            TextView deviceName = (TextView) convertView.findViewById(R.id.tvDeviceName);\r\n            TextView deviceAdress = (TextView) convertView.findViewById(R.id.tvDeviceAddress);\r\n\r\n            if (deviceName != null) {\r\n                deviceName.setText(device.getName());\r\n            }\r\n            if (deviceAdress != null) {\r\n                deviceAdress.setText(device.getAddress());\r\n            }\r\n        }\r\n\r\n        return convertView;\r\n    }\r\n\r\n}<\/pre>\n<p><strong>Step 6:<\/strong><\/p>\n<p>Now add these code\u00a0 in\u00a0 <strong>device_adapter_view layout<\/strong><\/p>\n<pre class=\"lang:xhtml decode:true\">&lt;?xml version=\"1.0\" encoding=\"utf-8\"?&gt;\r\n&lt;LinearLayout xmlns:android=\"http:\/\/schemas.android.com\/apk\/res\/android\"\r\n              android:orientation=\"vertical\"\r\n              android:layout_width=\"match_parent\"\r\n              android:layout_height=\"match_parent\"&gt;\r\n\r\n    &lt;TextView\r\n        android:layout_width=\"match_parent\"\r\n        android:layout_height=\"wrap_content\"\r\n        android:id=\"@+id\/tvDeviceName\"\r\n        android:textSize=\"15sp\"\/&gt;\r\n\r\n    &lt;TextView\r\n        android:layout_width=\"match_parent\"\r\n        android:layout_height=\"wrap_content\"\r\n        android:id=\"@+id\/tvDeviceAddress\"\r\n        android:textSize=\"15sp\"\/&gt;\r\n\r\n\r\n&lt;\/LinearLayout&gt;\r\n<\/pre>\n<p>Now on running this code, we can see our application will scan for available Bluetooth devices and we see the list of devices and can pair and connect with them for basic data communication(like sending text messages).<\/p>\n<p><strong>You can also read our blogs on Android:<\/strong><\/p>\n<p><strong>1:\u00a0<a href=\"https:\/\/www.innovationm.com\/blog\/android-navigation-component-android-jetpack\/\">Android Navigation Component \u2013 Android Jetpack<\/a><\/strong><\/p>\n<p><strong>2:\u00a0<a href=\"https:\/\/www.innovationm.com\/blog\/offline-content-storage-and-sync-with-server-when-modified\/\">Offline Content Storage and Sync with Server when Modified<\/a><\/strong><\/p>\n<p><strong>3:\u00a0<a href=\"https:\/\/www.innovationm.com\/blog\/custom-camera-using-surfaceview\/\">Custom Camera using SurfaceView<\/a><\/strong><\/p>\n<p><strong>4:\u00a0<a href=\"https:\/\/www.innovationm.com\/blog\/capture-image-on-eye-blink\/\">Capture Image on Eye Blink<\/a><\/strong><\/p>\n<p><strong>5:\u00a0<a href=\"https:\/\/www.innovationm.com\/blog\/how-to-use-data-binding-in-android\/\">How to Use Data Binding in Android<\/a><\/strong><\/p>\n<p>InnovationM is a globally renowned\u00a0<a href=\"https:\/\/www.innovationm.com\/android-app-development\">Android app development company in\u00a0India<\/a>\u00a0that caters to a strong &amp; secure Android app development, iOS app development, hybrid app development services. Our commitment &amp; engagement towards our target gives us brighter in the world of technology and has led us to establish success stories consecutively which makes us the best\u00a0<a href=\"https:\/\/www.innovationm.com\/ios-app-development\">iOS app development company in India<\/a>. We are also rated as the\u00a0<a href=\"https:\/\/www.innovationm.com\/mobile-app-development-company\">best Mobile app development company in India<\/a>.<\/p>\n<p>Thanks for giving your valuable time. Keep reading and keep learning &#x1f642;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Introduction: Bluetooth: The Android platform supports Bluetooth connection, which allows us to exchange data with other Bluetooth devices. The application framework provides Bluetooth related functionality through the Android Bluetooth APIs.All of the Bluetooth APIs are available in the Android Bluetooth package. There are two types of Bluetooth in Android Classic Bluetooth and Bluetooth devices with [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":5972,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2,71],"tags":[502,505,507,504,508,506,503],"class_list":["post-5955","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-android","category-mobile","tag-android-bluetooth-api","tag-android-bluetooth-data-transfer-tutorial","tag-android-bluetooth-package","tag-bluetooth-api-for-basic-data-transfer","tag-bluetooth-connection-service","tag-bluetooth-low-energybluetoothble","tag-how-to-use-android-bluetooth-api-for-basic-data-transfer-from-one-device-to-another-device"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.4 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>How To Use Android Bluetooth API For Basic Data Transfer From One Device To Another Device - InnovationM - Blog<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.innovationm.com\/blog\/how-to-use-android-bluetooth-api-for-basic-data-transfer-from-one-device-to-another-device\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How To Use Android Bluetooth API For Basic Data Transfer From One Device To Another Device - InnovationM - Blog\" \/>\n<meta property=\"og:description\" content=\"Introduction: Bluetooth: The Android platform supports Bluetooth connection, which allows us to exchange data with other Bluetooth devices. The application framework provides Bluetooth related functionality through the Android Bluetooth APIs.All of the Bluetooth APIs are available in the Android Bluetooth package. There are two types of Bluetooth in Android Classic Bluetooth and Bluetooth devices with [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.innovationm.com\/blog\/how-to-use-android-bluetooth-api-for-basic-data-transfer-from-one-device-to-another-device\/\" \/>\n<meta property=\"og:site_name\" content=\"InnovationM - Blog\" \/>\n<meta property=\"article:published_time\" content=\"2020-04-30T11:27:51+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2020-04-30T11:35:32+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.innovationm.com\/blog\/wp-content\/uploads\/2020\/04\/Blutooth-API.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1141\" \/>\n\t<meta property=\"og:image:height\" content=\"634\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"InnovationM Admin\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"InnovationM Admin\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"12 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.innovationm.com\\\/blog\\\/how-to-use-android-bluetooth-api-for-basic-data-transfer-from-one-device-to-another-device\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.innovationm.com\\\/blog\\\/how-to-use-android-bluetooth-api-for-basic-data-transfer-from-one-device-to-another-device\\\/\"},\"author\":{\"name\":\"InnovationM Admin\",\"@id\":\"https:\\\/\\\/www.innovationm.com\\\/blog\\\/#\\\/schema\\\/person\\\/a831bf4602d69d1fa452e3de0c8862ed\"},\"headline\":\"How To Use Android Bluetooth API For Basic Data Transfer From One Device To Another Device\",\"datePublished\":\"2020-04-30T11:27:51+00:00\",\"dateModified\":\"2020-04-30T11:35:32+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.innovationm.com\\\/blog\\\/how-to-use-android-bluetooth-api-for-basic-data-transfer-from-one-device-to-another-device\\\/\"},\"wordCount\":403,\"commentCount\":0,\"image\":{\"@id\":\"https:\\\/\\\/www.innovationm.com\\\/blog\\\/how-to-use-android-bluetooth-api-for-basic-data-transfer-from-one-device-to-another-device\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.innovationm.com\\\/blog\\\/wp-content\\\/uploads\\\/2020\\\/04\\\/Blutooth-API.jpg\",\"keywords\":[\"Android Bluetooth API\",\"android bluetooth data transfer tutorial\",\"Android Bluetooth package\",\"bluetooth api for basic data transfer\",\"Bluetooth Connection Service\",\"Bluetooth Low EnergyBluetooth(BLE)\",\"How To Use Android Bluetooth API For Basic Data Transfer From One Device To Another Device\"],\"articleSection\":[\"Android\",\"Mobile\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.innovationm.com\\\/blog\\\/how-to-use-android-bluetooth-api-for-basic-data-transfer-from-one-device-to-another-device\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.innovationm.com\\\/blog\\\/how-to-use-android-bluetooth-api-for-basic-data-transfer-from-one-device-to-another-device\\\/\",\"url\":\"https:\\\/\\\/www.innovationm.com\\\/blog\\\/how-to-use-android-bluetooth-api-for-basic-data-transfer-from-one-device-to-another-device\\\/\",\"name\":\"How To Use Android Bluetooth API For Basic Data Transfer From One Device To Another Device - InnovationM - Blog\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.innovationm.com\\\/blog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.innovationm.com\\\/blog\\\/how-to-use-android-bluetooth-api-for-basic-data-transfer-from-one-device-to-another-device\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.innovationm.com\\\/blog\\\/how-to-use-android-bluetooth-api-for-basic-data-transfer-from-one-device-to-another-device\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.innovationm.com\\\/blog\\\/wp-content\\\/uploads\\\/2020\\\/04\\\/Blutooth-API.jpg\",\"datePublished\":\"2020-04-30T11:27:51+00:00\",\"dateModified\":\"2020-04-30T11:35:32+00:00\",\"author\":{\"@id\":\"https:\\\/\\\/www.innovationm.com\\\/blog\\\/#\\\/schema\\\/person\\\/a831bf4602d69d1fa452e3de0c8862ed\"},\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.innovationm.com\\\/blog\\\/how-to-use-android-bluetooth-api-for-basic-data-transfer-from-one-device-to-another-device\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.innovationm.com\\\/blog\\\/how-to-use-android-bluetooth-api-for-basic-data-transfer-from-one-device-to-another-device\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.innovationm.com\\\/blog\\\/how-to-use-android-bluetooth-api-for-basic-data-transfer-from-one-device-to-another-device\\\/#primaryimage\",\"url\":\"https:\\\/\\\/www.innovationm.com\\\/blog\\\/wp-content\\\/uploads\\\/2020\\\/04\\\/Blutooth-API.jpg\",\"contentUrl\":\"https:\\\/\\\/www.innovationm.com\\\/blog\\\/wp-content\\\/uploads\\\/2020\\\/04\\\/Blutooth-API.jpg\",\"width\":1141,\"height\":634,\"caption\":\"Blutooth API Basic Data Transfer\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.innovationm.com\\\/blog\\\/how-to-use-android-bluetooth-api-for-basic-data-transfer-from-one-device-to-another-device\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.innovationm.com\\\/blog\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How To Use Android Bluetooth API For Basic Data Transfer From One Device To Another Device\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.innovationm.com\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/www.innovationm.com\\\/blog\\\/\",\"name\":\"InnovationM - Blog\",\"description\":\"\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.innovationm.com\\\/blog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.innovationm.com\\\/blog\\\/#\\\/schema\\\/person\\\/a831bf4602d69d1fa452e3de0c8862ed\",\"name\":\"InnovationM Admin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/5c99d9eece9dfbc82297cf34ddd58e9fe05bb52fe66c8f6bf6c0a45bfb6d7629?s=96&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/5c99d9eece9dfbc82297cf34ddd58e9fe05bb52fe66c8f6bf6c0a45bfb6d7629?s=96&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/5c99d9eece9dfbc82297cf34ddd58e9fe05bb52fe66c8f6bf6c0a45bfb6d7629?s=96&r=g\",\"caption\":\"InnovationM Admin\"},\"sameAs\":[\"http:\\\/\\\/www.innovationm.com\\\/\"],\"url\":\"https:\\\/\\\/www.innovationm.com\\\/blog\\\/author\\\/innovationmadmin\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How To Use Android Bluetooth API For Basic Data Transfer From One Device To Another Device - InnovationM - Blog","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.innovationm.com\/blog\/how-to-use-android-bluetooth-api-for-basic-data-transfer-from-one-device-to-another-device\/","og_locale":"en_US","og_type":"article","og_title":"How To Use Android Bluetooth API For Basic Data Transfer From One Device To Another Device - InnovationM - Blog","og_description":"Introduction: Bluetooth: The Android platform supports Bluetooth connection, which allows us to exchange data with other Bluetooth devices. The application framework provides Bluetooth related functionality through the Android Bluetooth APIs.All of the Bluetooth APIs are available in the Android Bluetooth package. There are two types of Bluetooth in Android Classic Bluetooth and Bluetooth devices with [&hellip;]","og_url":"https:\/\/www.innovationm.com\/blog\/how-to-use-android-bluetooth-api-for-basic-data-transfer-from-one-device-to-another-device\/","og_site_name":"InnovationM - Blog","article_published_time":"2020-04-30T11:27:51+00:00","article_modified_time":"2020-04-30T11:35:32+00:00","og_image":[{"width":1141,"height":634,"url":"https:\/\/www.innovationm.com\/blog\/wp-content\/uploads\/2020\/04\/Blutooth-API.jpg","type":"image\/jpeg"}],"author":"InnovationM Admin","twitter_misc":{"Written by":"InnovationM Admin","Est. reading time":"12 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.innovationm.com\/blog\/how-to-use-android-bluetooth-api-for-basic-data-transfer-from-one-device-to-another-device\/#article","isPartOf":{"@id":"https:\/\/www.innovationm.com\/blog\/how-to-use-android-bluetooth-api-for-basic-data-transfer-from-one-device-to-another-device\/"},"author":{"name":"InnovationM Admin","@id":"https:\/\/www.innovationm.com\/blog\/#\/schema\/person\/a831bf4602d69d1fa452e3de0c8862ed"},"headline":"How To Use Android Bluetooth API For Basic Data Transfer From One Device To Another Device","datePublished":"2020-04-30T11:27:51+00:00","dateModified":"2020-04-30T11:35:32+00:00","mainEntityOfPage":{"@id":"https:\/\/www.innovationm.com\/blog\/how-to-use-android-bluetooth-api-for-basic-data-transfer-from-one-device-to-another-device\/"},"wordCount":403,"commentCount":0,"image":{"@id":"https:\/\/www.innovationm.com\/blog\/how-to-use-android-bluetooth-api-for-basic-data-transfer-from-one-device-to-another-device\/#primaryimage"},"thumbnailUrl":"https:\/\/www.innovationm.com\/blog\/wp-content\/uploads\/2020\/04\/Blutooth-API.jpg","keywords":["Android Bluetooth API","android bluetooth data transfer tutorial","Android Bluetooth package","bluetooth api for basic data transfer","Bluetooth Connection Service","Bluetooth Low EnergyBluetooth(BLE)","How To Use Android Bluetooth API For Basic Data Transfer From One Device To Another Device"],"articleSection":["Android","Mobile"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.innovationm.com\/blog\/how-to-use-android-bluetooth-api-for-basic-data-transfer-from-one-device-to-another-device\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.innovationm.com\/blog\/how-to-use-android-bluetooth-api-for-basic-data-transfer-from-one-device-to-another-device\/","url":"https:\/\/www.innovationm.com\/blog\/how-to-use-android-bluetooth-api-for-basic-data-transfer-from-one-device-to-another-device\/","name":"How To Use Android Bluetooth API For Basic Data Transfer From One Device To Another Device - InnovationM - Blog","isPartOf":{"@id":"https:\/\/www.innovationm.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.innovationm.com\/blog\/how-to-use-android-bluetooth-api-for-basic-data-transfer-from-one-device-to-another-device\/#primaryimage"},"image":{"@id":"https:\/\/www.innovationm.com\/blog\/how-to-use-android-bluetooth-api-for-basic-data-transfer-from-one-device-to-another-device\/#primaryimage"},"thumbnailUrl":"https:\/\/www.innovationm.com\/blog\/wp-content\/uploads\/2020\/04\/Blutooth-API.jpg","datePublished":"2020-04-30T11:27:51+00:00","dateModified":"2020-04-30T11:35:32+00:00","author":{"@id":"https:\/\/www.innovationm.com\/blog\/#\/schema\/person\/a831bf4602d69d1fa452e3de0c8862ed"},"breadcrumb":{"@id":"https:\/\/www.innovationm.com\/blog\/how-to-use-android-bluetooth-api-for-basic-data-transfer-from-one-device-to-another-device\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.innovationm.com\/blog\/how-to-use-android-bluetooth-api-for-basic-data-transfer-from-one-device-to-another-device\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.innovationm.com\/blog\/how-to-use-android-bluetooth-api-for-basic-data-transfer-from-one-device-to-another-device\/#primaryimage","url":"https:\/\/www.innovationm.com\/blog\/wp-content\/uploads\/2020\/04\/Blutooth-API.jpg","contentUrl":"https:\/\/www.innovationm.com\/blog\/wp-content\/uploads\/2020\/04\/Blutooth-API.jpg","width":1141,"height":634,"caption":"Blutooth API Basic Data Transfer"},{"@type":"BreadcrumbList","@id":"https:\/\/www.innovationm.com\/blog\/how-to-use-android-bluetooth-api-for-basic-data-transfer-from-one-device-to-another-device\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.innovationm.com\/blog\/"},{"@type":"ListItem","position":2,"name":"How To Use Android Bluetooth API For Basic Data Transfer From One Device To Another Device"}]},{"@type":"WebSite","@id":"https:\/\/www.innovationm.com\/blog\/#website","url":"https:\/\/www.innovationm.com\/blog\/","name":"InnovationM - Blog","description":"","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.innovationm.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/www.innovationm.com\/blog\/#\/schema\/person\/a831bf4602d69d1fa452e3de0c8862ed","name":"InnovationM Admin","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/5c99d9eece9dfbc82297cf34ddd58e9fe05bb52fe66c8f6bf6c0a45bfb6d7629?s=96&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/5c99d9eece9dfbc82297cf34ddd58e9fe05bb52fe66c8f6bf6c0a45bfb6d7629?s=96&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/5c99d9eece9dfbc82297cf34ddd58e9fe05bb52fe66c8f6bf6c0a45bfb6d7629?s=96&r=g","caption":"InnovationM Admin"},"sameAs":["http:\/\/www.innovationm.com\/"],"url":"https:\/\/www.innovationm.com\/blog\/author\/innovationmadmin\/"}]}},"_links":{"self":[{"href":"https:\/\/www.innovationm.com\/blog\/wp-json\/wp\/v2\/posts\/5955","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.innovationm.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.innovationm.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.innovationm.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.innovationm.com\/blog\/wp-json\/wp\/v2\/comments?post=5955"}],"version-history":[{"count":0,"href":"https:\/\/www.innovationm.com\/blog\/wp-json\/wp\/v2\/posts\/5955\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.innovationm.com\/blog\/wp-json\/wp\/v2\/media\/5972"}],"wp:attachment":[{"href":"https:\/\/www.innovationm.com\/blog\/wp-json\/wp\/v2\/media?parent=5955"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.innovationm.com\/blog\/wp-json\/wp\/v2\/categories?post=5955"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.innovationm.com\/blog\/wp-json\/wp\/v2\/tags?post=5955"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}