Notifications are everywhere in today's mobile applications. In our example, for this recipe we will explore how to use a cross-platform NuGet package and minimize the amount of code to show local notifications to the user.
Open Visual Studio and create a Blank App (Xamarin.Forms Portable) cross-platform solution from the top menu, File | New | Project…, named
XamFormsLocalNotifications
.For each native platform project, right-click and choose Manage NuGet Package; search and install the
Xam.Plugins.Notifier
NuGet package and click Install.Go to the
App.cs
file in theXamFormsLocalNotifications
class library and replace the constructor with the following code:public App() { ILocalNotifications localNotifications = DependencyService.Get<ILocalNotifications>(); Button showNotificationButton = new Button(); showNotificationButton.Text = "Show Local Notification"; showNotificationButton.Clicked += (sender, e) => localNotifications...