Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Notification Tapped not working on iOS / Xamarin.Forms #417

Open
j-bbr opened this issue Jun 8, 2023 · 9 comments
Open

Notification Tapped not working on iOS / Xamarin.Forms #417

j-bbr opened this issue Jun 8, 2023 · 9 comments
Assignees
Labels
bug Something isn't working iOS iOS only issue

Comments

@j-bbr
Copy link

j-bbr commented Jun 8, 2023

Describe the bug
No NotificationActionTapped or NotificationReceived events on Xamarin.Forms.

To Reproduce
Steps to reproduce the behavior:

  1. Install Plugin
  2. subscribe to events
  3. Tap on Notification / Actions
  4. Nothing happens

Expected behavior
A clear and concise description of what you expected to happen.
Notification Events firing

Screenshots
If applicable, add screenshots to help explain your problem.

Platform (please complete the following information):

  • OS: [e.g. iOS] iOS 16
  • Version [e.g. 22]: 10.1.5

Smartphone (please complete the following information):

  • Device: [e.g. iPhone6] IPhone Simulator / Physical Device
  • OS: [e.g. iOS8.1] 16
  • Version [e.g. 22] 10.1.5

Additional context
Add any other context about the problem here.
I noticed that the Plugin comes with it's own Notification Delegate for iOS as described here. But I haven't seen where it's actually initialized in the documentation or the sample. So setting it in AppDelegate.FinishedLaunching like this:
UNUserNotificationCenter.Current.Delegate = new UserNotificationCenterDelegate();
gave me the expected behaviour. Happy to add that to the documentation if desired.

@j-bbr j-bbr added the bug Something isn't working label Jun 8, 2023
@thudugala
Copy link
Owner

@j-bbr please try version 10.1.6, make sure to call LocalNotificationCenter.SetUserNotificationCenterDelegate();

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

            LocalNotificationCenter.SetUserNotificationCenterDelegate();

            LoadApplication(new App());

            return base.FinishedLaunching(app, options);
        }

	public override void WillEnterForeground(UIApplication uiApplication)
        {
            LocalNotificationCenter.ResetApplicationIconBadgeNumber(uiApplication);
            base.WillEnterForeground(uiApplication);
        }
}

@thudugala thudugala added the iOS iOS only issue label Jun 17, 2023
@j-bbr
Copy link
Author

j-bbr commented Jun 19, 2023

I've tried it and unfortunately the other changes to UserNotificationCenterDelegate broke iOS Foreground Notifications

@thudugala
Copy link
Owner

@j-bbr can you please attach a sample project?

@thudugala
Copy link
Owner

@j-bbr Try version 10.1.7

@Cinmay2014
Copy link

@j-bbr please try version 10.1.6, make sure to call LocalNotificationCenter.SetUserNotificationCenterDelegate();

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

            LocalNotificationCenter.SetUserNotificationCenterDelegate();

            LoadApplication(new App());

            return base.FinishedLaunching(app, options);
        }

	public override void WillEnterForeground(UIApplication uiApplication)
        {
            LocalNotificationCenter.ResetApplicationIconBadgeNumber(uiApplication);
            base.WillEnterForeground(uiApplication);
        }
}

I have the same issue. I tried this method, but still not working. Notification pops up, but the tapped action doesn't work.
if needed, I will attach a sample project. Already in the newest version.
@thudugala

@j-bbr Did you solve your problem?

@thudugala
Copy link
Owner

@Cinmay2014 Yes please attach a sample project

@Cinmay2014
Copy link

@thudugala Hi Elvin, attached is the sample project. It works fine for Android but failed for iOS.
If you have time, please check it. Really appreciate it.
https://github.com/Cinmay2014/sample01

@thudugala
Copy link
Owner

@Cinmay2014 it works for me

image

@Cinmay2014
Copy link

@thudugala Can you test the weekly notification? when the weekly notification pops up and it is clicked, nothing happened. It should navigate to the weeklytips page.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working iOS iOS only issue
Projects
None yet
Development

No branches or pull requests

3 participants