title: Why do I always get BUSY when using WifiP2pManager?
body: <p>I am trying to connect two Android-Devices using Wi-Fi Direct.</p>
  
  <p>On my HTC-Phone (One SV) it seems to work, but with my second device a LG Optimus 4xhd it doesnt work.</p>
  
  <p>In my onResume() function I start the following thread:</p>
  
  <pre><code>new Thread(){
          private int count=0;
          public void run()
          {
              mManager.discoverPeers(mChannel, new WifiP2pManager.ActionListener() {
  
                  @Override
                  public void onSuccess() {
                      Log.d(tag,"SUCCESS - started discovering peers");
  
                  }
  
                  @Override
                  public void onFailure(int reason) {
                      count++;
  
                      String err=new String();
                      if(reason==WifiP2pManager.BUSY) err="BUSY";
                      if(reason==WifiP2pManager.ERROR)err="ERROR";
                      if(reason==WifiP2pManager.P2P_UNSUPPORTED) err="P2P_UNSUPPORTED";
                      Log.d(tag,"FAIL - couldnt start to discover peers code: "+err+" ("+count+")");
                      try {
                          Thread.sleep(1000);
                      } catch (InterruptedException e) {
                          // TODO Auto-generated catch block
                          e.printStackTrace();
                      }
                      if(count&gt;=20)return;
                      mManager.discoverPeers(mChannel, this);
                  }
              });
          }
      }.start();
  </code></pre>
  
  <p>As I said before: this works fine on my HTC.
  But with the LG I just get "FAIL - couldnt start to discover peers code: BUSY" (20 times).</p>
  
  <p>I also tried WifiP2pManager.createGroup() with the same result.</p>
  
  <p>Another thing that I realized is, that my BroadcastReceiver with the following filters doesnt receive anything on my LG (HTC gets some broadcasts).
  Filters:</p>
  
  <pre><code> filter.addAction(WifiP2pManager.WIFI_P2P_STATE_CHANGED_ACTION);
      // Indicates a change in the list of available peers.
      filter.addAction(WifiP2pManager.WIFI_P2P_PEERS_CHANGED_ACTION);
      // Indicates the state of Wi-Fi P2P connectivity has changed.
      filter.addAction(WifiP2pManager.WIFI_P2P_CONNECTION_CHANGED_ACTION);
      // Indicates this device's details have changed.
      filter.addAction(WifiP2pManager.WIFI_P2P_THIS_DEVICE_CHANGED_ACTION);
  </code></pre>
  
  <p>I am not trying any fancy stuff. I'm just following the Api-Guides for Wi-Fi Direct on <a href="http://developer.android.com/guide/topics/connectivity/wifip2p.html" rel="nofollow">http://developer.android.com/guide/topics/connectivity/wifip2p.html</a></p>
  
  <p>Is there anything I can do? I cant understand why the LG-Phone should work that different.</p>
  
  <p>Just to make one last thing sure: In my onCreate() I get and Init my Manager as followed:</p>
  
  <pre><code> mManager = (WifiP2pManager) getSystemService(MainActivity.WIFI_P2P_SERVICE);
      mChannel = mManager.initialize(this, getMainLooper(), receiver);
  </code></pre>
  
  <p>And it seems to work on both devices. (I get a Channel back)</p>