Code example for BluetoothDevice

Methods: createRfcommSocketToServiceRecord

0
		} catch (RuntimeException e) {}
 
		try { 
            BluetoothAdapter mBluetoothAdapter = BluetoothAdapter.getDefaultAdapter();
            BluetoothDevice device = mBluetoothAdapter.getRemoteDevice(host);
			this.sock = device.createRfcommSocketToServiceRecord(REMUCO_UUID);
            this.sock.connect();
            isClosed = false;
		} catch (SecurityException e) {
			throw new UserException("Connection Error", 
					"Not allowed to connect to " + host);
		} catch (IOException e) {
			throw new UserException("Connection Error", 
					"IO error while setting up the connection to " + host);
		} catch (Exception e) {
			throw new UserException("Connection Error", 
					"Error while setting up the connection to " + host);
		} 
 
		try { 
			is = sock.getInputStream();