Tutorial by Topics: dependencyservice

If you do not want your code to break when no implementation is found, check the DependencyService first if it has a implementation available. You can do this by a simple check if it is not null. var speaker = DependencyService.Get<ITextToSpeech>(); if (speaker != null) { speaker....
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 ...
Access platform specific API from PCL or Shared project.

Page 1 of 1