Code example for WifiP2pManager

Methods: requestConnectionInfo

0
	      NetworkInfo networkInfo =  
	        (NetworkInfo)intent.getParcelableExtra(extraKey); 
 
	      // Check if we're connected 
	      if (networkInfo.isConnected()) { 
	        mManager.requestConnectionInfo(mChannel,  
	          new ConnectionInfoListener() { 
	            public void onConnectionInfoAvailable(WifiP2pInfo info) {  
	              // If the connection is established 
	              if (info.groupFormed) { 
	                // If we're the server 
	                if (info.isGroupOwner) { 
	                  // Initiate server socket. 
	                  initiateServerSocket(); 
	                  //Create server socket 
	                  //MessageServerAsyncTask serverSocket = new MessageServerAsyncTask(this); 
	                  //serverSocket.execute(); 
	                } 
	                // If we're the client 
	                else if (info.groupFormed) { 
	                  // Initiate client socket.