Code example for BluetoothSocket

Methods: getInputStreamgetOutputStreamisConnected

0
	public LiveThread(BluetoothSocket socket, Handler handler) {
    	Log.d("Method - ","LiveThread constructor");
    	this.handler = handler;
        bluetoothSocket = socket;
         
        if ( bluetoothSocket.isConnected() ) {
        	Log.d("Method - ","LiveThread Constructor: bluetoothSocket is connected.");
        } else { 
        	Log.e("Method - ","LiveThread Constructor: bluetoothSocket is not connected.");
        } 
  
        try { 
        	inputStream = bluetoothSocket.getInputStream();
        	outputStream = bluetoothSocket.getOutputStream();
        } catch (IOException e) { 
        	Log.e("Method - ","LiveThread Constructor: Exception message - "+e.getMessage());
        	handler.obtainMessage(HANDLER_CODE_EXCEPTION_MESSAGE, "Input/Output stream Error").sendToTarget();
        } 
    } 
     
Stop searching for code, let great code find you!  Add Codota to your java IDE