我编写了代码,用于检测附近可用的Wifi路由器,并显示其SSID和BSSID。但我不想出现一切。我只需要某些SSID的路由器。我如何过滤它们?我试图使用匹配字符串,但它没有帮助。请帮帮我们
答案 0 :(得分:0)
您可以尝试过滤SSID
private ArrayList<String> getListOfMyConnetions(){
ArrayList<String> listOfMyConnections = new ArrayList<String>;
List<ScanResult> scanResults = wifi.getScanResults();
if (scanResults != null) {
for(ScanResult s : scanResults) {
//"CONNECTION_NAME" is the name of SSID you would like filter
if (s.SSID != null && s.SSID.contains(CONNECTION_NAME)) {
listOfMyConnections.add( s.SSID );
}
}
}
return listOfMyConnections;
}