Detect connection type (Wifi/3G...) RRS feed

  • Question

  • Is there a way to detect current network connection type between Ethernet/Wifi/3G etc...? Inside connectivity sample i can get many informations but can't find this one.


    Corrado Cavalli [Microsoft .NET MVP-MCP]
    UGIdotNET - http://www.ugidotnet.org
    Weblog: http://blogs.ugidotnet.org/corrado/
    Twitter: http://twitter.com/corcav

    Monday, June 4, 2012 11:04 AM


  • If you just want to know the connection type (ethernet/wireless/etc) you can do that with the NetworkAdapter's IANAInterfaceType: http://msdn.microsoft.com/en-us/library/windows/apps/windows.networking.connectivity.networkadapter.ianainterfacetype.aspx

    For example:

    var profile = Windows.Networking.Connectivity.NetworkInformation.getInternetConnectionProfile();
    if (profile) {
        var interfaceType = profile.networkAdapter.ianaInterfaceType;
        if (interfaceType === 71) {
            console.log('on Wireless');
        else if (interfaceType === 6) {
            console.log('on Ethernet');
        else {
            console.log('on something weird...');

    I'm not sure how the cost stuff works, but I think it's just for 3G/metered connections where Windows can get rate information. I think the above should be good enough if you just want to do something simple like switch to higher fidelity video streams when people are plugged in versus on wireless. 



    • Marked as answer by Dino He Tuesday, June 12, 2012 7:54 AM
    Wednesday, June 6, 2012 8:30 PM

All replies