Checking network availability in Windows Phone
This article explains how to check the availability of network connection on Windows Phone 7.
Many applications utilize network connection for various purposes like feeds, sending & receiving data to/from server, etc. The following article explains how one can detect if the network connection is available or not.
Network API Information
- NetworkInterface Class helps in providing network information to the developers. It helps detect if the network is on/off, address etc.
- NetworkInterface::GetIsNetworkAvailable is used to check if the network connection is available.The network connection is considered to be available if interface is not in loopback or is marked as “up”.
- Namespace: System.Net.NetworkInformation
Example Code to understand the network connection
public partial class MainPage : PhoneApplicationPage
public static readonly DependencyProperty NetProperty =
string isNetworkAvail =
NetworkInterface.GetIsNetworkAvailable() ? "on" : "off";