Showing posts with label local notification. Show all posts

In this tutorial, we will see how to display the local notification from the .Net MAUI application. For this, we are using the ...

.Net MAUI - Local Notification .Net MAUI - Local Notification

A blog about android developement

local notification

episode8

In this tutorial, we will see how to display the local notification from the .Net MAUI application. For this, we are using the "Plugin.LocalNotification" plugin which is compatible with Xamarin.Forms and .Net MAUI. To know more, visit here.


Quick Links:


Project Setup:

  • Launch Visual Studio 2022, and in the start window click Create a new project to create a new project.
  • In the Create a new project window, select MAUI in the All project types drop-down, select the .NET MAUI App template, and click the Next button:
  • In the configure your new project window, name your project, choose a suitable location for it, and click the Next button:
  • In the Additional information window, click the Create button:
  • Once the project is created, we can able to see the Android, iOS, Windows and other running options in the toolbar. Press the emulator or run button to build and run the app

Implementation:

  • Open Nuget Manager, search "Plugin.LocalNotification" and install the plugin.
  • To show the notification, open your *.xaml.cs file and add namespace "Plugin.LocalNotification" by including "using Plugin.LocalNotifications;"
  • In Solution Explorer, click MainPage.xaml and replace the page content with what is shown below:
  • Open the MainPage.xaml.cs file and the page content as shown below:
  • Here,
  • Title: Notification Title
  • Description: Notification Description
  • Subtitle: Notification Subtitle for collapsed view
  • Schedule: DateTime value to show the notification after the mentioned schedule
  • Repeat: DateTime value to repeat the notification after the mentioned frequency

Demo:



Full Code:

Download Code:

You can download the code from GitHub. If you have any doubts, feel free to post a comment. If you liked this article, and it is useful to you, do like, share the article & star the repository on GitHub.