Android Wi-Fi Scan: Filter printers from ScanResult

Viewed 1124

I am working on a project, that needs to scan for public Wi-Fi access points.

Currently, I am filtering the ScanResult like this:

for (ScanResult scanResult : wifiList) {
  if (!(scanResult.capabilities.contains("WEP") || 
        scanResult.capabilities.contains("WPA") || 
        scanResult.capabilities.contains("WPA2"))) {

              openWifiList.add(scanResult);    

  }
}

It works fine, except that I also get printers that are nearby.

While scanning, the phone is not connected to any network.

I would have assumed that I get a list that is identically with the list of Wi-Fi connections that is shown in the Wi-Fi Settings on Android. But in the Wi-Fi Setting there is no printer shown ever.

So for 1) I think it is strange that printers show up in the ScanResult list at all, should printers really be visible that way?


UPDATE: not all Wi-Fi printers are visible, I got some hints on that, and it seems like the printers that are showing up, do have a special functionality, e.g. HP printers support the HP Wireless Direct functionality (see e.g. https://h30434.www3.hp.com/t5/Inkjet-Printing/Printer-SSID-appearing-on-my-wi-fi-list/td-p/1705073 and https://support.hp.com/rs-en/document/c04577030).


And 2) is there any way that I could check whether the ScanResult belongs to a printer?

So far I could only think of filtering for common SSID names, but that will not be very efficient or reliable.

Thanks for any suggestions.

2 Answers
Related