Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there an easier fast way to detect whether the (Windows Phone 7) device has an internet connection

Is there an easier fast way to detect whether the (Windows Phone 7) device has an internet connection.

I'm currently sending a web request, waiting the timeout period and handling the exception. Hoping for a quick easy way to query the device to see whether it has a connection before sending any requests...

Thanks in advance,

like image 463
will Avatar asked Sep 09 '10 20:09

will


2 Answers

This method will return NetworkInterfaceType.None if there is no connection.

NetworkInterface.GetInternetInterfaceType

Alternatively you will get NetworkInterfaceType.MobileBroadbandGSM, NetworkInterfaceType.Wireless80211, etc if there is a connection.

like image 185
Mick N Avatar answered Sep 23 '22 18:09

Mick N


There isn't really a faster way, though instead of a dummy request for this, perhaps you could actually make the request for data that you want, so if it does come back, you can handle the data without making a 2nd request.

like image 24
Jeff Wilcox Avatar answered Sep 22 '22 18:09

Jeff Wilcox