开发者

Getting Device Info Programmatically in WP7

I would like to know whether the following are possible in the current windows phone 7 SDK:

  • Getting the device's OS version 开发者_如何学Goprogrammatically.
  • Detecting programmatically whether the data connection is available in the device or not
  • Programmatically getting the type of network connection that the device is currently having either wifi or LAN


You can get the OS version by doing using System.Environment.OSVersion. The numbers at the end will be the current running version. You can confirm this on your phone by going to Settings...About and seeing if the numbers match.

You can use the NetworkInterface.GetIsNetworkAvailable method to determine if there is any data connection available.

To determine the type of connection, you can use NetworkInterface.GetInternetInterfaceType. This will return a valume of enum NetworkInterfaceType. If the value is Ethernet, the user is plugged into the computer and using its data connection. (Of course, you should test the values returned to confirm that they're what you expected them to be).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜