All Projects → thudugala → Plugin.localnotification

thudugala / Plugin.localnotification

Licence: mit
The local notification plugin provides a way to show local notifications from Xamarin Forms apps .

Projects that are alternatives of or similar to Plugin.localnotification

Xaml Code Experiences
A collection of the experiences I have collected during days of Xamarin and Wpf, while following the MVVM design pattern.
Stars: ✭ 114 (-8.06%)
Mutual labels:  xamarin, xamarin-forms
Aiforms.layouts
AiForms.Layouts (WrapLayout) for Xamarin.Forms
Stars: ✭ 94 (-24.19%)
Mutual labels:  xamarin, xamarin-forms
Xam.plugin.simplebottomdrawer
Just a nice and simple BottomDrawer for your Xamarin Forms project
Stars: ✭ 92 (-25.81%)
Mutual labels:  xamarin, xamarin-forms
Aivisualprovision
Connect(); 2018 - AI Visual Provision Sample App
Stars: ✭ 116 (-6.45%)
Mutual labels:  xamarin, xamarin-forms
Customnavigationbarsample
Navigation Bar Customization in Xamarin Forms
Stars: ✭ 104 (-16.13%)
Mutual labels:  xamarin, xamarin-forms
Crossplatformdisktest
Windows, macOS and Android storage (HDD, SSD, RAM) speed testing/performance benchmarking app
Stars: ✭ 123 (-0.81%)
Mutual labels:  xamarin, xamarin-forms
Reactivemvvm
Cross-platform ReactiveUI sample app built for a talk at MSK .NET conf.
Stars: ✭ 94 (-24.19%)
Mutual labels:  xamarin, xamarin-forms
Barcodescanner.xf
Barcode Scanner using GoogleVision API for Xamarin Form
Stars: ✭ 82 (-33.87%)
Mutual labels:  xamarin, xamarin-forms
Latestversionplugin
LatestVersion Plugin for Xamarin and Windows apps
Stars: ✭ 99 (-20.16%)
Mutual labels:  xamarin, xamarin-forms
Xamarin Plugins
Cross-platform Plugins for Xamarin, Xamarin.Forms and Windows
Stars: ✭ 97 (-21.77%)
Mutual labels:  xamarin, xamarin-forms
Xdtoxf
Adobe XD Plugin to export assets to Xamarin.Forms XAML Styles and Resources
Stars: ✭ 118 (-4.84%)
Mutual labels:  xamarin, xamarin-forms
Htmllabelplugin
Use this Xamarin.Forms plugin to display HTML content into a label.
Stars: ✭ 119 (-4.03%)
Mutual labels:  xamarin, xamarin-forms
Bottomtabbedpage Xamarin Forms
A page control for Xamarin.Forms to place tabs at the bottom.
Stars: ✭ 90 (-27.42%)
Mutual labels:  xamarin, xamarin-forms
Xamarin Forms Perf Playground
Xamarin.Forms Performance Playground (Layouts, Bindings, XAMLC, etc)
Stars: ✭ 119 (-4.03%)
Mutual labels:  xamarin, xamarin-forms
Ffimageloading
Image loading, caching & transforming library for Xamarin and Windows
Stars: ✭ 1,288 (+938.71%)
Mutual labels:  xamarin, xamarin-forms
Mytripcountdown
Xamarin.Forms goodlooking UI sample
Stars: ✭ 94 (-24.19%)
Mutual labels:  xamarin, xamarin-forms
Faceoff
An iOS, Android and UWP app created in Xamarin.Forms that uses Microsoft's Cognitive Emotion API Services to compare facial expressions
Stars: ✭ 79 (-36.29%)
Mutual labels:  xamarin, xamarin-forms
Xamuidemo
Xamarin Forms Login Page UI Kit
Stars: ✭ 82 (-33.87%)
Mutual labels:  xamarin, xamarin-forms
Art Plant Mall
Xamarin.Forms goodlooking UI sample.
Stars: ✭ 96 (-22.58%)
Mutual labels:  xamarin, xamarin-forms
Dayvsnight
DayVsNight - A Xamarin.Forms UI Challenge
Stars: ✭ 112 (-9.68%)
Mutual labels:  xamarin, xamarin-forms
icon

Build status CI NuGet NuGet

Plugin.LocalNotification

The local notification plugin provides a way to show local notifications from Xamarin.Forms apps.

Setup

Platform Support

Platform Supported Version Notes
Xamarin.iOS Yes iOS 10+
Xamarin.Android Yes API 19+ Project should target Android framework 10.0+

Usage

Show local notification

var notification = new NotificationRequest
{
    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);

Receive local notification tap event

public partial class App : Application
{
	public App()
	{
		InitializeComponent();

		// Local Notification tap event listener
		NotificationCenter.Current.NotificationTapped += OnLocalNotificationTapped;

		MainPage = new MainPage();
	}
	
	private void OnLocalNotificationTapped(NotificationTappedEventArgs e)
    	{
		// your code goes here
	}
}

Notification received event

On iOS this event is fired only when the app is in foreground

public partial class App : Application
{
	public App()
	{
		InitializeComponent();

		// Local Notification received event listener
		NotificationCenter.Current.NotificationReceived += OnLocalNotificationReceived;

		MainPage = new MainPage();
	}
	
	private void OnLocalNotificationReceived(NotificationReceivedEventArgs e)
    	{
		// your code goes here
	}
}

Platform Specific Notes

Android

Project should target Android framework 10.0+

image

Setup

To receive Local Notification tap event. Include the following code in the OnNewIntent() method of MainActivity:

public class MainActivity : global::Xamarin.Forms.Platform.Android.FormsAppCompatActivity
{
	protected override void OnCreate(Bundle savedInstanceState)
	{
	        .....
	        // Must create a Notification Channel when API >= 26
                // you can created multiple Notification Channels with different names.
                NotificationCenter.CreateNotificationChannel();		
		.....		
		LoadApplication(new App());
		.....	
		NotificationCenter.NotifyNotificationTapped(Intent);
	}

	protected override void OnNewIntent(Intent intent)
	{
		NotificationCenter.NotifyNotificationTapped(intent);
		base.OnNewIntent(intent);
	}
}

iOS

Setup

You must get permission from the user to allow the app to show local notifications. Also, To receive Local Notification tap event. Include the following code in the FinishedLaunching() method of AppDelegate:

public partial class AppDelegate : global::Xamarin.Forms.Platform.iOS.FormsApplicationDelegate
{        
        public override bool FinishedLaunching(UIApplication app, NSDictionary options)
        {
            global::Xamarin.Forms.Forms.Init();

            // Ask the user for permission to show notifications on iOS 10.0+ at startup.
            // If not asked at startup, user will be asked when showing the first notification.
            Plugin.LocalNotification.NotificationCenter.AskPermission();

            LoadApplication(new App());

            return base.FinishedLaunching(app, options);
        }

	public override void WillEnterForeground(UIApplication uiApplication)
        {
            Plugin.LocalNotification.NotificationCenter.ResetApplicationIconBadgeNumber(uiApplication);
        }
}

Screen Record

Screen Record

Notification Channels

Setting up Notification Channels

Custom Sound

Notification with a Sound-File

SourceLink Support

In Visual Studio, confirm that SourceLink is enabled. Also, Turn off "Just My Code" since, well, this isn't your code.

https://docs.microsoft.com/en-us/dotnet/standard/library-guidance/sourcelink

Limitations

Only support iOS and Android for the moment.

4.1.4 Documentation

  • Please go to 4.1.4 Documentation, if you are referencing a version below 5.0.0.
  • Version 5.* has setup differences in Android if upgrading from version 3.*

3.0.2 Documentation

  • Please go to 3.0.2 Documentation, if you are referencing a version below 4.0.0.
  • Version 4.* has setup differences in Android if upgrading from version 3.*

2.0.7 Documentation

  • Please go to 2.0.7 Documentation, if you are referencing a version below 3.0.0.
  • Version 3.* has breaking changes if upgrading from version 2.*

Contributing

Contributions are welcome. Feel free to file issues and pull requests on the repo and they'll be reviewed as time permits.

Icon and Sound

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].