Plugin for Easy Cross Platform notifications
- Local Notifications
- Scheduled Notifications
- Sounds
- Read all Scheduled Notifications
- Badges
- Set metadata on each notification for identification
- Cancel individual or all notifications
- iOS 6+
- macOS
- Android 4+
- Universal Windows Platform (Win10/UWP)
- NET Standard 1.0
Install the nuget package in your platform project as well as your netstandard library.
await CrossNotifications.Current.Send("My Title", "My message for the notification");
await CrossNotifications.Current.Send("Happy Birthday", "I sent this a long time ago", when = TimeSpan.FromDays(50));
var list = await CrossNotifications.Current.GetScheduledNotifications();
var id = await CrossNotifications.Current.Send("Hi", "This is my scheduled notification", when = TimeSpan.FromDays(1));
await CrossNotifications.Current.Cancel(id);
CrossNotifications.Current.CancelAll();
Setting badges works on all platforms, though only select flavours of Android. A 3rd party library is used to accomplish this.
await CrossNotifications.Current.SetBadge(4);
await CrossNotifications.Current.GetBadge();
// 0 clears badge
In the notification.Sound property - set only the filename without the extension
- Put the sound in your /Resources/raw/ folder - make sure the file properties is set to AndroidResource
- You can pass the actual full sound path OR just the name... the plugin will figure it out!
- Put the file in your iOS app bundle
- The file format must be a .caf file (google this to see how to make one) - ie. afconvert -f caff -d aacl@22050 -c 1 sound.aiff soundFileName.caf
- Supports aac, flac, m4a, mp3, wav, & wma file formats
- For desktop v1511, custom audio will not work. The plugin will ignore the sound config if it sees this.
- Read the following article for more info: https://blogs.msdn.microsoft.com/tiles_and_toasts/2016/06/18/quickstart-sending-a-toast-notification-with-custom-audio/
-
Why are most methods async now?
-
iOS requires all UI based commands run on the UI thread. Notifications are part of UIKit and thus have this requirement. With all of my plugins, I try to manage the thread marshalling for you
-
Why can't I set a string as an identifier
-
Android needs an integer for how it sets identifiers