title: Retrieve wifi connection status(Android)
body: <p>I have followed the <a href="https://stackoverflow.com/questions/4374862/how-to-programatically-create-and-read-wep-eap-wifi-configurations-in-android/4374934#4374934">following link</a> to connect with local wifi. It is working perfect. I am able to connect to my local wifi. </p>
  
  <p>But, I really want the current status of the wifi, I am using following code to get the status of wifi. But unfortunately I am only able to get 'DISABLED', 'ENABLED' and 'SCANNING' status, I really want to receive other intermediary states.</p>
  
  <p>Can you tell me what I am doing wrong.</p>
  
  <pre><code>public class ConnectionChangeReceiver extends BroadcastReceiver {
      @Override
      public void onReceive(Context context, Intent intent) {
  
          NetworkInfo info = intent.getParcelableExtra(ConnectivityManager.EXTRA_NETWORK_INFO);
          Message msg = new Message();
          msg.what = 5;
          Bundle b = new Bundle();
          String sStatus = "UnKnown";
          switch(info.getDetailedState()){
          case AUTHENTICATING:
              sStatus = "Authenticating...";
              break;
          case    CONNECTED:
              sStatus = "Connected";
              break;
          case    CONNECTING:
              sStatus = "Connecting...";
              break;
          case    DISCONNECTED:
              sStatus = "Disconnected";
              break;
          case    DISCONNECTING:
              sStatus = "Disconnecting...";
              break;
          case    FAILED:
              sStatus = "Failed";
              break;
          case    IDLE:
              sStatus = "Idle";
              break;
          case    OBTAINING_IPADDR :
              sStatus = "Obtaining IP Address...";
              break;
          case    SCANNING:
              sStatus = "Scanning...";
              break;
          case    SUSPENDED:
              sStatus = "Suspended";
              break;
          }
          b.putString("status", sStatus);
          msg.setData(b);
          mHandler.sendMessage(msg);
      }
  }
  </code></pre>
  
  <p>I register the broadcast receiver in the following way</p>
  
  <pre><code>IntentFilter filter = new IntentFilter(
          ConnectivityManager.CONNECTIVITY_ACTION);
      registerReceiver(networkStateReceiver, filter);
  </code></pre>