-
-
Notifications
You must be signed in to change notification settings - Fork 73
Usage 3.0.2
Elvin (Tharindu) Thudugala edited this page Jun 6, 2019
·
1 revision
| Platform | Supported | Version | Notes |
|---|---|---|---|
| Xamarin.iOS | Yes | iOS 10+ | |
| Xamarin.Android | Yes | API 21+ | Project should target Android framework 9.0+ |
var notification = new Plugin.LocalNotification.LocalNotification
{
NotificationId = 100,
Title = "Test",
Description = "Test Description",
ReturningData = "Dummy data", // Returning data when tapped on notification.
NotifyTime = DateTime.Now.AddSeconds(30) // Used for Scheduling local notification, if not specified notification will show immediately.
};
NotificationCenter.Current.Show(notification);NotificationCenter.Current.Cancel(100);public partial class App : Application
{
public App()
{
InitializeComponent();
// Local Notification tap event listener
NotificationCenter.Current.NotificationTapped += OnLocalNotificationTapped;
MainPage = new MainPage();
}
private void OnLocalNotificationTapped(LocalNotificationTappedEvent e)
{
// your code goes here
}
}Notification Icon must be set for notification to appear.
You can set the notification Icon by setting the following property from inside your Android project:
NotificationCenter.NotificationIconId = Resource.Drawable