Code example for BluetoothSocket

Methods: connectgetInputStreamgetOutputStream

		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);        
        mOutputStream = mSocket.getOutputStream();
        mInputStream = mSocket.getInputStream();
        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];
Stop searching for code, let great code find you!  Add Codota to your java IDE