-
Notifications
You must be signed in to change notification settings - Fork 66
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 Receiving not working on iOS when in foreground #414
Comments
Workaround: Add this to the class linked below |
@gsk143 please try version 10.1.6 |
@thudugala struggling with this issue, 10.1.6 did seem to resolve the issue unfortunately. Others maybe able to also confirm this. |
@LeoJHarris Are you having the issue in Xamarin or .NET Maui ? |
@thudugala issue is in Xamarin Forms. Using latest of this library. |
@LeoJHarris Please try version 10.1.7 Make sure to call LocalNotificationCenter.SetUserNotificationCenterDelegate(); https://github.com/thudugala/Plugin.LocalNotification/wiki/Usage-10.0.0-Xamarin.Forms |
@thudugala still not working iOS. |
Hey @LeoJHarris can you attach a sample project? |
Recording.2023-06-30.011418.mp4 |
@thudugala I'm not too sure which NuGet version your using in that sample screen but I pulled your repo and ran the NuGet sample project, updated the NuGet package from 8.0.2 (notifications working) => 10.1.8 (notifications not working): |
Make sure to call LocalNotificationCenter.SetUserNotificationCenterDelegate(); https://github.com/thudugala/Plugin.LocalNotification/wiki/2.-Usage-10.0.0-Xamarin.Forms |
Have now added Its still the same sample project that was updated from 8.0.2 (notifications working) => 10.1.8 (notifications not working and calls |
Please read the doc fully https://github.com/thudugala/Plugin.LocalNotification/wiki/2.-Usage-10.0.0-Xamarin.Forms you need to request Permission if (await LocalNotificationCenter.Current.AreNotificationsEnabled() == false)
{
await LocalNotificationCenter.Current.RequestNotificationPermission();
} |
@thudugala thanks for assisting, its working now if I call:
but using DI does not work which I had been doing previously:
I registered the service like this:
Another comment here #334 (comment) pointed out using Dependency Injection was not working with this plugin. Is there a way to register and use with DI? iOS seems not to be working with DI, android is okay. |
Will look into it as soon as possible next week. |
@LeoJHarris for Xamarin Forms, you must register this plugin to the DI by yourself. It's only registered automatically in .Net MAUI |
@thudugala I am already doing the DI like this: _ = containerRegistry.RegisterInstance(LocalNotificationCenter.Current); |
,@LeoJHarris can attach a sample project? |
Hello, |
@nikubesliu is permission granted to show notifications? Can you attach a sample project? |
@thudugala Sorry I havnt been able to get reproduce this in a small sample application, seemed to occur in the production app we have but Ill need to double check things again when I have time. |
Describe the bug
Notification Receiving not working on iOS
To Reproduce
Use sample code in the repo and add
LocalNotificationCenter.Current.NotificationReceived += NotificationRecived;
private void NotificationRecived(NotificationEventArgs e) { MainThread.BeginInvokeOnMainThread(() => Shell.Current.DisplayAlert(GlobalConstants.Notification.SyncNotificationTitle, GlobalConstants.Notification.SyncNotificationDesc, AppRes.Ok)); }
Expected behavior
Should fire the event in the foreground and the user can do his logic
Platform:
The text was updated successfully, but these errors were encountered: