简体   繁体   中英

How to get WI-FI signal strength in percantage from Scan Network?

I need to Scan Wifi Networks.

How can i getRssi() of WiFi Scan Network (Not of connection wi-fi network)

        int level = WifiManager.calculateSignalLevel(wifi.getConnectionInfo().getRssi(),
                        results.get(i).level);
                int difference = level * 100 / results.get(i).level;

Ok try this to find signal strength

    WifiManager manager;
    manager = (WifiManager) getSystemService(WIFI_SERVICE);
    List<ScanResult> results = manager.getScanResults();
    int level = getPowerPercentage(results.get(0).level);//0 for first scan result and so on.

Method to find signal stength

    public int getPowerPercentage(int power) {
    int i = 0;
    int MIN_DBM = -100;
    if (power <= MIN_DBM) {
        i = 0;
    } else {
        i = 100 + power;
    }

    return i;
}

Hope this ll help you.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM