locked
How to get Wi-Fi information of Windows 8.1 machine(RT/Laptop) in Store app.

    Question

  • Hi,

    how can i get the Wi-Fi connection information for Store app(8.1):

    how can i find out:

    1.  whether device is connected to WiFi ?

    2.  if it is connected to Wi-Fi then what is the Wi-Fi address ?

    i am using below code :

                           

    var ipAddres = string.Empty;

                    IReadOnlyList<HostName> allHosts = NetworkInformation.GetHostNames();

                    foreach (HostName hs in allHosts)
                    {
                        if (hs.IPInformation != null)
                           if (!hs.DisplayName.StartsWith("169") && hs.IPInformation.NetworkAdapter.IanaInterfaceType == 71)

                               ipAddres = hs.DisplayName;
                                break;
                            
                        
                    }
                    return ipAddres;

    but is failing if device is using bridge for internet connection.

    if device is using bridge for internet connection in that case  "hs.IPInformation.NetworkAdapter.IanaInterfaceType" is comming as '6'. which is matching type of Ethernet.

    i am clueless why this API is giving wrong information.

    Thanks,

    Monday, November 10, 2014 12:18 PM

All replies