Code example for WifiP2pManager

Methods: requestPeers

0
 
            // request available peers from the wifi p2p manager. This is an 
            // asynchronous call and the calling activity is notified with a 
            // callback on PeerListListener.onPeersAvailable() 
            if (manager != null) {
                manager.requestPeers(channel, mNetInfManager);
            } 
            Log.d(TAG, "P2P peers changed");
        } else if (WifiP2pManager.WIFI_P2P_CONNECTION_CHANGED_ACTION.equals(action)) {
 
            if (manager == null) {
                return; 
            } 
 
            NetworkInfo networkInfo = (NetworkInfo) intent
                    .getParcelableExtra(WifiP2pManager.EXTRA_NETWORK_INFO);
 
            if (networkInfo.isConnected()) {
 
                // we are connected with the other device, request connection 
                // info to find group owner IP