Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iphone monotouch detect if there is an internet connection

In Monotouch on an iPhone/iPod, how do I detect if there is an internet connection available?

like image 783
Ian Vink Avatar asked Dec 01 '25 01:12

Ian Vink


1 Answers

The best way right now is to use this class from Miguel de Icaza's GitHub repository:

https://github.com/xamarin/monotouch-samples/blob/master/ReachabilitySample/reachability.cs

Its a static class with a lot of methods, so all you have to do is add it to your project and call, for example:

NetworkStatus status = Reachability.InternetConnectionStatus();
like image 69
Eduardo Scoz Avatar answered Dec 03 '25 15:12

Eduardo Scoz



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!