Native Services with Xamarin.Forms? It's DependencyService to the Rescue

As you know, Xamarin.Forms is a great mechanism to create cross-platform applications that run natively on iOS, Android and Windows Phone. Xamarin.Forms provides a great set of services that run the same across all OSes, however, there are times when it's necessary to make calls that are platform-specific. That's what DependencyService is for.

I'll show an example by performing reverse geocoding on each platform. For each platform, there will be a reverse geocode call made to the platform-specific implementation. Most Web services that provide reverse geocoding services cost money for each call. But by calling the platform-specific implementation, there's no need to call out to a Web service from within your code. The platform-specific reverse geocode will call its own Web service for which your program does not need to pay.

Url: https://visualstudiomagazine.com/articles/2015/09/01/native-services-with-xamarinforms.aspx

No Comments