How to check if the user is connected to the internet wp7 ?
how do you check if the user is connected 开发者_Go百科to the internet ? ive a program that uses services and i'd like to check first
thanks
As seen on http://www.diaryofaninja.com/blog/2010/12/09/checking-for-network-connectivity-in-windows-phone-7-sdk:
if (NetworkInterface.GetIsNetworkAvailable())
{
}
Should be the correct way.
The phone api does not have a status for internet acces. You will need to actually make a call to test whether it's available despite the various statuses. See What is the best way to check for Internet connectivity using .NET?
精彩评论