Xamarin.FormsDependencyService


Remarks

When using DependencyService you typically need 3 parts:

  • Interface - This defines the functions you wish to abstract.
  • Platform implementation - A class within each platform specific project that implements the previously defined interface.
  • Registration - Each platform specific implementation class has to be registered with the DependencyService through a metadata attribute. This enables the DependencyService to find your implementation at run time.

When using DependencyService you are required to provide an implementation for each platform you target. When an implementation is not provided the application will fail at run time.