title: Android and WiFi Direct - Problems Connecting
body: <p>So I have been working with WiFi Direct with quite some time and throughout it all I have been plagued with connection issues.  Since updating to 4.1 where there is no longer a hard button to turn WiFi Direct on and off, I seemingly always have inconsistencies with connecting. For my uses, I do not need to find peers, just connect to peers from stored device addresses from earlier interactions. Sometimes the devices will connect right away, other times the second device won't receive the invitation, and other times the first device will be stuck trying to send an invitation indefinitely. Below is my connect code, it's pretty bare so I am not sure what is wrong. Any help would be appreciated!  Thank you very much.</p>
  
  <pre><code>WifiP2pConfig config = new WifiP2pConfig();
  SlideMenuItem item = sideMenu.getItem(itemId);
  config.deviceAddress = item.label;
  config.wps.setup = WpsInfo.PBC;
  
  if (progressDialog != null &amp;&amp; progressDialog.isShowing()) {
       progressDialog.dismiss();
   }
  progressDialog = ProgressDialog.show(mContext, "Press back to cancel",
                  "Connecting to :" + item.label, true, true);
  manager.connect(channel, config, new ActionListener() {
  
              @Override
              public void onSuccess() {
                  // WiFiDirectBroadcastReceiver will notify us. Ignore for now.
              }
  
              @Override
              public void onFailure(int reason) {
                  Toast.makeText(mContext, "Connect failed. Retry.", Toast.LENGTH_SHORT).show();
              }
          });
  
  @Override
  public void onConnectionInfoAvailable(WifiP2pInfo arg0) {
      // TODO Auto-generated method stub
      if (progressDialog != null &amp;&amp; progressDialog.isShowing()) {
          progressDialog.dismiss();
      }
      Toast.makeText(this, "Succesfully connected.", Toast.LENGTH_SHORT).show();
  }
  </code></pre>