Code example for WifiP2pManager

Methods: discoverPeers

0
     */ 
    @Override 
    protected void onResume() { 
        super.onResume(); 
 
        mManager.discoverPeers(mChannel, new WifiP2pManager.ActionListener() {
 
            @Override 
            public void onSuccess() { 
                Toast.makeText(getApplicationContext(), "Discovery Initiated",
                        Toast.LENGTH_SHORT).show();
            } 
 
            @Override 
            public void onFailure(int reasonCode) {
                Toast.makeText(getApplicationContext(),
                        "Discovery Failed : " + getDiscoveryFailureReasonCode(reasonCode),
                        Toast.LENGTH_SHORT).show();
            } 
        }); 
Connect your IDE to all the code out there  Get Codota for Java