Code example for BluetoothSocket

Methods: getInputStream, getOutputStream

1
            InputStream tmpIn = null;
            OutputStream tmpOut = null;
 
            // Get the BluetoothSocket input and output streams 
            try { 
                tmpIn = socket.getInputStream();
                tmpOut = socket.getOutputStream();
            } catch (IOException e) {
                Log.e(TAG, "temp sockets not created", e);
            } 
 
            mmInStream = tmpIn;
            mmOutStream = tmpOut;
        } 
 
        public void run() { 
            Log.i(TAG, "BEGIN mConnectedThread");
            byte[] buffer = new byte[1024];
             
            // Keep listening to the InputStream while connected 
            while (true) {