2014-02-05 66 views
0

我試圖循環訪問點的掃描結果wifiManager以返回RSSI強度(dbm)。我有什麼至今:循環播放結果並獲取scanInfo.level

public class MyWifiReceiver extends 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 
      List<ScanResult> results= wifiManager.getScanResults(); 
     } 
} 
+0

問題是?順便說一句。你forgott閉幕彎曲支架... –

回答

0
public class MyWifiReceiver extends BroadcastReceiver { 

     @Override 
     public void onReceive(Context context, Intent intent) { 
      final WifiManager lWifiManager = (WifiManager) getSystemService(Context.WIFI_SERVICE); 
      boolean a= lWifiManager.startScan();//request a scan for access points 
      final List<ScanResult> lResults= lWifiManager.getScanResults(); 
      for(final ScanResult lScanResult : lResults){ 
      System.out.println("ScanResult level: "+lScanResult.level); 
      }  
     } 
} 

應該做你所需要的。 據我所見levelScanResult的公共班級成員。