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 = new DataInputStream(tmpIn);
            mmOutStream = new DataOutputStream(tmpOut);
//            mmInStream = new DataInputStream(new BufferedInputStream(tmpIn, 8192)); 
//            mmOutStream = new DataOutputStream(new BufferedOutputStream(tmpOut, 8192)); 
        } 
 
        public void run() { 
            Log.i(TAG, "BEGIN mConnectedThread");
 
            // Keep listening to the InputStream while connected