我需要扫描Wifi网络。
我如何getRssi()
WiFi扫描网络(不是连接Wi-Fi网络)
int level = WifiManager.calculateSignalLevel(wifi.getConnectionInfo().getRssi(),
results.get(i).level);
int difference = level * 100 / results.get(i).level;
答案 0 :(得分:1)
好的,试试这个来找到信号强度
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.
查找信号强度的方法
public int getPowerPercentage(int power) {
int i = 0;
int MIN_DBM = -100;
if (power <= MIN_DBM) {
i = 0;
} else {
i = 100 + power;
}
return i;
}
希望这会帮助你。