- NuGet: Plugin.Share
PM> Install-Package Plugin.Share
- Install into ALL of your projects, include client projects.
- namespace:
using Plugin.Share
It is drop dead simple to gain access to the Share APIs in any project. All you need to do is get a reference to the current instance of IShare via CrossShare.Current
:
public void DoPluginStuff()
{
CrossShare.Current.DOSTUFF();
//this is not the real API, keep reading :)
}
There may be instances where you install a plugin into a platform that it isn't supported yet. This means you will have access to the interface, but no implementation exists. You can make a simple check before calling any API to see if it is supported on the platform where the code is running. This if nifty when unit testing:
public void DoPluginStuff()
{
if(!CrossShare.IsSupported)
return true;
CrossShare.Current.DOSTUFF();
//this is not the real API, keep reading :)
}
You must set your app to compile against API 25 or higher and be able to install the latest Android support libraries. I have written a nifty blog to guide you through this.
<= Back to Table of Contents