Code example for WifiP2pManager

Methods: connect

0
	public void connectToPeer(WifiP2pDevice peer) {
		WifiP2pConfig config = new WifiP2pConfig();
		config.deviceAddress = peer.deviceAddress;
		config.wps.setup = WpsInfo.PBC;
		 
		mManager.connect(mChannel, config, new ActionListener() {
			@Override 
			public void onSuccess() { 
				// Let WifiBroadcastReceiver notify us. Ignore it here. 
			} 
			 
			@Override 
			public void onFailure(int reason) {
				// TODO: notify someone. 
			} 
		}); 
	} 
	 
	/** 
	 * Initiate peer discovery to start the discovery process. Discovery will 
	 * remain active until a connection is initiated or a P2P group is formed.