title: How to get connection and carrier information in Windows Phone 8.1 Runtime
body: <p>I currently am porting one of my libraries to Windows Phone 8.1 Runtime and stepped into a missing API which you can use in Windows Phone 8.0 and Windows Phone Silverlight 8.1 apps.</p>
  
  <p>What I need is the DeviceNetworkInformation to get with what kind of NetworkInterfaceType is the device connected to the internet.</p>
  
  <p>Sample code in Windows Phone 8.0.</p>
  
  <pre><code>public void GetDeviceConnectionInfo()
  {
      DeviceNetworkInformation.ResolveHostNameAsync(new DnsEndPoint("microsoft.com", 80),
          nrr =&gt;
          {
              NetworkInterfaceInfo info = nrr.NetworkInterface;
              if (info != null)
              {
                  switch (info.InterfaceType)
                  {
                      case NetworkInterfaceType.Ethernet:
                          // Do something
                          break;
                      case NetworkInterfaceType.MobileBroadbandCdma:
                      case NetworkInterfaceType.MobileBroadbandGsm:
                          switch (info.InterfaceSubtype)
                          {
                              case NetworkInterfaceSubType.Cellular_3G:
                              case NetworkInterfaceSubType.Cellular_EVDO:
                              case NetworkInterfaceSubType.Cellular_EVDV:
                              case NetworkInterfaceSubType.Cellular_HSPA:
                                  // Do something
                                  break;
                          }
                          // Do something
                          break;
                      case NetworkInterfaceType.Wireless80211:
                          // Do something
                          break;
                  }
              }
          }, null);
  }
  </code></pre>
  
  <p>And you could access the carrier's name with <code>DeviceNetworkInformation.CellularMobileOperator</code>.</p>