Question

I know if the device is connected or not to a wifi router. For security reasons I would like to know if that connection is a private one (one of those I have the password for, like Home, Work...) or if it is just a public open one without a password (library, airport...).

Is it possible?

Was it helpful?

Solution

Herei am providing you code to find list of all available wifi and their informations like BSSID,SSID etc. Here you can find that particular wifi is public or private.

create beans for wifi data named WifiDataBeans

public class WifiDataBeans {
public String ssid;
public String bssid;
public String compatibility;
public int freq;
public int level;}

and in you mainActivity

     WifiManager manager;
    public  ArrayList<WifiDataBeans> list = new ArrayList<WifiDataBeans>();

in onCreate()

        manager = (WifiManager) getSystemService(WIFI_SERVICE);

            List<ScanResult> results = manager.getScanResults();
                    for (int i = 0; i < results.size(); ++i) 
        {
            WifiDataBeans bean = new WifiDataBeans();
            bean.ssid = results.get(i).SSID;
            bean.bssid = results.get(i).BSSID;
            bean.compatibility = results.get(i).capabilities;
            bean.freq = results.get(i).frequency;
            bean.level = getPowerPercentage(results.get(i).level);
            list.add(bean);

        }

here you can check for all list of wifi BSSID,if they have that means private otherwise public.

OTHER TIPS

Yes , you can check for particular wifi that it is a private one or public one. You can get all the list of available wifi and can get their BSSID,if any wifi connection have BSSID that means this on is private otherwise not.If you want code plz let me know.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top