title: Get WiFi Signal Strength of Connected Network
body: <p>I'm trying to display the signal strength of the connected WiFi network in my Android app.  I've tried the following:</p>
  
  <pre><code>//Receiver for information on the network info
  private BroadcastReceiver mNetworkReceiver = new BroadcastReceiver()
  {
      @Override
      public void onReceive(Context context, Intent intent) 
      {
          Log.d("INFO", "onReceive()");
          List&lt;ScanResult&gt; scanResult = mWifi.getScanResults();
          for(ScanResult scan : scanResult)
          {
              Log.d("INFO","Network strength: " + String.valueOf(scan.level) + " dBm " + scan.SSID);
          }
      }   
  };
  </code></pre>
  
  <p>And then I do the registering/unregistering of my receiver on the onResume()/onPause():</p>
  
  <pre><code>@Override
  public void onResume()
  {
      super.onResume();
      mActivity.registerReceiver(mNetworkReceiver, new IntentFilter(WifiManager.SCAN_RESULTS_AVAILABLE_ACTION)); //network info
  }
  
  @Override
  public void onPause()
  {
      super.onPause();
      mActivity.unregisterReceiver(mNetworkReceiver);
  }
  </code></pre>
  
  <p>But this doesn't seem to work.  I also have the <code>ACCESS_WIFI_STATE</code> permission enabled.  My receiver is only called if I call <code>&lt;WiFiManager&gt;.startScan()</code> manually, but I'm trying to get it to work with my broadcast receiver so that I can always show the signal strength whenever it changes.  I noticed that the <code>onReceive()</code> provides a list which is unnecessary if I just want the connected network's stats.  Any way to change that too?</p>
  
  <p>edit: Also, I realize that there are some related questions on this, but the ones I've read weren't too helpful.
  edit2: Clarified my question a bit.  The main problem is that my receiver is never called unless I call <code>startScan()</code>.</p>