Namespaces
Variants
Actions
Revision as of 04:58, 24 April 2012 by hamishwillee (Talk | contribs)

Checking network availability in Windows Phone

Jump to: navigation, search

This article explains how to check the availability of network connection on Windows Phone 7.

WP Metro Icon Wifi.png
Article Metadata

Tested with
Article
Created: SeemaB (24 Sep 2011)
Last edited: hamishwillee (24 Apr 2012)

Introduction

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";
}
}
}
315 page views in the last 30 days.
Nokia Developer aims to help you create apps and publish them so you can connect with users around the world.

京ICP备05048969号  © Copyright Nokia 2013 All rights reserved