Code example for BluetoothAdapter

Methods: getAddress

0
	public void sendMessage(Message message) {
        OutputStream outStream;
		try { 
			outStream = this.socket.getOutputStream();
            PrintWriter writer = new PrintWriter(outStream);
            message.setSourceAddress(this.bluetoothAdapter.getAddress());
            writer.println(message.encode());
            writer.flush();	
		} catch (IOException e) {
			Log.w("Failed to send message  " + message + " to destination " + destinationAddress, e);
		} 
	} 
	 
	public void terminate() { 
		//TODO remove this socket handler from client socket handlers list 
		//clientSocketHandlers.remove(this.destinationAddress); 
		this.running = false;
		try { 
			this.socket.close();
		} catch (IOException e) {
			Log.w("Exception caught while destroying BluetoothSocketHandler.", e);