title: wifiManager.startScan not returning any results (need some guidance please)
body: <p>At this moment in time I am trying to build an Android application that will be able to locate a wifi enabled device indoors. So I have broken it down into various steps in order and 1 of the steps is to scan for available wireless networks and return the signal strength etc associated with each access point that it discovers (it doesn't have to connect to the access points but just has to ping them for information). Below shows the  snippet of code that I have created and when the code is debugged it isn't identifying an wifi access points so could someone tell me where the problem is or point me in the right direction.</p>
  
  <pre><code>myWifiMan.startScan();
  List&lt;ScanResult&gt; wifiList = myWifiMan.getScanResults();
  if (wifiList != null) {
      //Construct Clue
      for(int i = 0; i &lt; wifiList.size(); i++) {
          message = message + "'" + wifiList.get(i).SSID +"':" + Integer.toString(wifiList.get(i).level);
          if((i+1) &lt; wifiList.size())
          message = message + ",";
      }
      message = message + "}]";
  </code></pre>
  
  <p>due to the answer given below would the following code give me the desired results?</p>
  
  <pre><code>private void initializeWiFiListener(){
  
      System.out.println("executing initializeWiFiListener");
      String connectivity_context = Context.WIFI_SERVICE;
      final WifiManager wifi = (WifiManager)getSystemService(connectivity_context);
      if(!wifi.isWifiEnabled()){
          if(wifi.getWifiState() != WifiManager.WIFI_STATE_ENABLING){
              wifi.setWifiEnabled(true);
          }
  
      }
      registerReceiver(new BroadcastReceiver(){
          @Override
          public void onReceive(Context context, Intent intent) {             
              WifiManager wifiManager = (WifiManager) getSystemService(Context.WIFI_SERVICE);
              boolean a= wifiManager.startScan();//request a scan for access points
              final List&lt;ScanResult&gt; results= wifiManager.getScanResults();//list of access points from the last scan
                  for(final ScanResult result : results){
                  System.out.println("ScanResult level: "+ result.level);
              }               
          }
      }, new IntentFilter(WifiManager.SCAN_RESULTS_AVAILABLE_ACTION));
  }
  </code></pre>