Code example for BluetoothAdapter

Methods: listenUsingInsecureRfcommWithServiceRecord

0
	public ThreadedRemoteConnection listenForRemoteConnection() { 
		GenericThreadedRemoteConnection connection = null;
		socket = null;
		 
		try{ 
			listener = adapter.listenUsingInsecureRfcommWithServiceRecord(name, uuid);
			socket = listener.accept();
			 
			if(socket != null){
				Log.d(TAG, "connection accepted");
				connection = new GenericThreadedRemoteConnection(activity, 
						socket.getInputStream(), socket.getOutputStream());
			} else { 
				Log.e(TAG, "no connection found");
			} 
			 
		} catch(IOException e){
			e.printStackTrace();
		} 
		 
Stop searching for code, let great code find you!  Add Codota to your java IDE