I am developing a WP7 app, which needs online connectivity. Before navigating to any page from mainpage.xaml, I am checking whether or not the device is connected to the internet using:
isAvailable = NetworkInterface.GetIsNetworkAvailable();
The app only continues if isAvailable is true; otherwise, it shows a pop stating “Please check your WI-FI connectivity”
Question: Initially, the app is connected to the internet, but how should I handle situations where internet connectivity is lost while I’m using the app, but after the initial check?
Should I check for isAvailable = NetworkInterface.GetIsNetworkAvailable(); on every page load or before every service call? Is there a better way of implementing this?
1 Answer