Uncategorized

Checking network availability in Windows Phone

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

Example Code to understand the network connection

namespace NetworkTest
{
public partial class MainPage : PhoneApplicationPage
{
public static readonly DependencyProperty NetProperty =
DependencyProperty.Register("NetworkAvailability",
typeof(string),
typeof(MainPage),
new PropertyMetadata(string.Empty));
 
public MainPage()
{
InitializeComponent();
string isNetworkAvail =
NetworkInterface.GetIsNetworkAvailable() ? "on" : "off";
}
}
}

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.