I am learning how to use Xamarin forms and I want to implement (push) notifications on Xamarin Forms. I have googled but to no avail. Does anyone know how to implement Local/Push notifications with Xamarin Forms? I am going to use an actual server at a later date but for now just showing a notification when I, for example, press a button, is totally OK for me.
Thanks for your help!
edit:
I am now using the DependencyService to access the Device OS's notification system instead of trying to use Xamarin Forms itself. Answers on this question are not necessary anymore!
In models, we need to create the below class with Title, Body, ID, IconId and NotifyTime. It will be useful to pass a local notification data to BroadcastReceiver receiver for repeating in Android. Create a class LocalNotificationService and we need to implement LocalNotification and Cancel methods like below.
Local notifications reach users whether your app is running in the foreground or the background and require no external infrastructure to send, which is why they are aptly termed “local.” These notifications simply require that a user's device is on in order to be received.
Xamarin's documentation includes a guide to notifications:
https://developer.xamarin.com/guides/cross-platform/application_fundamentals/notifications/
It covers both local and remote notifications, including recommendations for libraries (e.g., PushSharp, UrbanAirship) to handle sending push notifications.
You can use https://www.nuget.org/packages/Xam.Plugins.Notifier plugin for local notifications. This is one of the best plugin I've used with Xamarin Forms.
You can also try local notification plug-in for Xamarin Forms https://www.nuget.org/packages/Plugin.LocalNotification/. It has more features and look at the source code if you are implementing your own version.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With