-1
protected void onCreate(Bundle savedInstanceState) {

    super.onCreate(savedInstanceState);

    setContentView(R.layout.activity_main);
    WifiManager mainWifiObj;
    mainWifiObj = (WifiManager) getSystemService(Context.WIFI_SERVICE); 
    class WifiScanReceiver extends BroadcastReceiver {

       public void onReceive(Context c, Intent intent) {
       }
    }
    WifiScanReceiver wifiReciever = new WifiScanReceiver();
    registerReceiver(wifiReciever, new IntentFilter(WifiManager.SCAN_RESULTS_AVAILABLE_ACTION));

    List<ScanResult> wifiScanList = mainWifiObj.getScanResults(); int signalLevel = 0; StringBuilder sb = new StringBuilder();
    for (ScanResult result : wifiScanList) {

      sb.append(result.level)  ;
    } 
    TextView tv = new TextView(this);
    tv.setText(sb); 
    setContentView(tv);

This code gives me all the signal strength from the routers connected . It gives me answers as for e.g -43 -55 -66 -76 -85 -87. Now I want to access a particular routers signal strength only. Not all the 6 six routers which are connected.

How can I find the strength for a particular router ?

Can you please help me out. Thanks in advance.

1 Answer 1

0

Just look at the SSID:

for (ScanResult result : wifiScanList) {
    if( result.SSID.equals( "TheSSIDIWant" )
        Log.d( "Wifi Scan", "Signal Level for TheSSIDIWant is " + result.level );
} 

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.