edsnider / localnotificationsplugin

Local Notifications Plugin for Xamarin and Windows
MIT License
198 stars 82 forks source link

Notification Action #5

Open Krystille opened 7 years ago

Krystille commented 7 years ago

Can I add some action to execute when the user clicks the notification or is there a way to do this? In your sample, it only relaunch the application. I want to open a page when clicking the notification.

rdrscan commented 7 years ago

+1 I was looking for a event in application's level to handle a notification touched event.

gpledran commented 7 years ago

+1 I'm also looking for this feature

rdrscan commented 7 years ago

Hello guys!

I'm proposing a simple modification to handle this situation:

https://github.com/rdrscan/LocalNotificationsPlugin/commit/4401f58a5a15d1fe5e19c7e6235cf5e45bddc668 I also made a pull request: https://github.com/edsnider/LocalNotificationsPlugin/pull/8

KubusPuchatek commented 7 years ago

+1 Any info?

justintemplar commented 7 years ago

+1 Though also include iOS as well please.

SandipAhluwalia commented 7 years ago

+1 UWP support would be good too. Looked at the code and it seems a new implementation just for UWP (currently it is supported via https://github.com/edsnider/LocalNotificationsPlugin/blob/master/src/Plugin.LocalNotifications.WinRT) would be needed using maybe https://www.nuget.org/packages/Microsoft.Toolkit.Uwp.Notifications/ so that you can then set the ToastContent.Launch property to the desired id/query string. This can then be handled in OnActivated within the UWP app code.

santiagobiart commented 6 years ago

+1 Is there any news about this feature? It would be awesome to have it. By the way does someone knows how to redirect to detail page to show Notification Details, can't find a solution and see in the Xamarin forums a lot of people with the same issue. Thanks in advance! This plugin is awesome, just add this functionality please!

stesvis commented 5 years ago

I think that a click event on a local notification is essential. It's safe to assume that everybody needs to execute an action when they click on the notification. It would be complete and awesome!

ianvink commented 5 years ago

In iOS just do this:

` public override void ReceivedLocalNotification(UIApplication application, UILocalNotification notification) { string NotificationKey = "LocalNotificationKey";

        var c = notification.UserInfo[NotificationKey];

        foreach (var x in notification.UserInfo.Keys)
        {
            var t = notification.UserInfo[x];
            var d = t.Description;
        }

        // show an alert

// UIAlertController okayAlertController = UIAlertController.Create(notification.AlertAction, notification.AlertBody, UIAlertControllerStyle.Alert); // okayAlertController.AddAction(UIAlertAction.Create("OK", UIAlertActionStyle.Default, null)); // // Window.RootViewController.PresentViewController(okayAlertController, true, null); // // // reset our badge // UIApplication.SharedApplication.ApplicationIconBadgeNumber = 0; }`