Code example for BluetoothSocket

Methods: closeconnectgetInputStreamgetOutputStream

		mBluetoothSocket = (BluetoothSocket)m.invoke(mBluetoothDevice, Integer.valueOf(1));
        Log.d(tag, "Connecting...");
        try { 
            /** This is a blocking call and will only return on a successful connection or an exception. */ 
        } catch (IOException e) {
        	/** If target BT device not found or connection refused then return false. */ 
            try { 
            } catch (IOException e2) {
                Log.e(tag, "unable to close() socket during connection failure", e2);
            Log.e(tag,"returning false");
            return false; 
        Log.d(tag, "Connected");
        /** Get input and output stream handles for data transfer. */ 
		mInputStream = mBluetoothSocket.getInputStream();
		mOutputStream = mBluetoothSocket.getOutputStream();
		return true; 
	/** Function to send data over BT. 
	 * Task: (1)To send the byte array over Bluetooth Channel.