Reachability.Net: A unified API for reachability (network connectivity) on Xamarin Android and iOS

Do you need to check for internet connection on your mobile app? Don’t we all do it often and on many platforms (and for almost all apps)?
I found myself implementing it on iOS and on Android and then pulling my implementation to almost all the mobile apps that I write. This is not efficient, and can be done better, right? đŸ™‚

I have created a Nuget package for everything related to network connectivity and called it Reachability.Net. The package is open source and it is hosted on GitHub here. Currently, I am supporting Xamarin iOS and Xamarin Android. I might add Windows Phone support and .NET 4.5 depending on the feedback I get.

The library can be found on Nuget here. I have put some sample code on the read.me file on GitHub, and created few samples that are included in the package.

The library provides a unified API across all platforms. The implementation of the library is based on Xamarin Recipe on iOS, which can be found here. This is a good implementation and well tested. On Android, the Xamarin recipe, which could be found here, is not really great. The Xamarin Android recipe is based on the examples from the Android SDK docs, but it only checks whether the device is capable of connecting to the internet (or to wifi) or not. It does not indicate the current connection status. Therefore, I had to combine the Xamarin recipe with another check for connectivity to ensure correct results. More details on Reachability on Android could be found in this StackOverflow discussion.

OK, that’s all for me and I hope you enjoy using the library. Feel free to log any issues or feature requests on Github and would love to hear your feedback.

2 Replies to “Reachability.Net: A unified API for reachability (network connectivity) on Xamarin Android and iOS”

  1. Hi would you mind letting me know which hosting company you’re utilizing?

    I’ve loaded your blog in 3 completely different
    internet browsers and I must say this blog loads a lot quicker then most.
    Can you suggest a good web hosting provider at a honest price?

    Many thanks, I appreciate it!

Leave a Reply

Your email address will not be published. Required fields are marked *