Code example for BluetoothSocket

Methods: connect, getInputStream, getOutputStream

0
		Toast.makeText(this, "Bluetooth device found", Toast.LENGTH_SHORT).show();
	} 
	private void openBT() throws IOException { 
		UUID uuid = UUID.fromString("00001101-0000-1000-8000-00805f9b34fb"); //Standard SerialPortService ID
        mSocket = mDevice.createRfcommSocketToServiceRecord(uuid);        
        mSocket.connect();
        mOutputStream = mSocket.getOutputStream();
        mInputStream = mSocket.getInputStream();
         
        downloadBT(); 
         
        Toast.makeText(this, "Downloading Data", Toast.LENGTH_SHORT).show();
	} 
	private void downloadBT() { 
		final Handler handler = new Handler();
		final byte deliminter = 10; // This defines the end of character
									// This is the ASCII code for a newline character 
		stopWorker = false;
		readBufferPosition = 0;
		readBuffer = new byte[1024];
		workerThread = new Thread(new Runnable () {