question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Notification is not work in IOS

See original GitHub issue

Describe the bug I’m trying to get local notifications on the iOS platform, but nothing appears, it works fine on Android, but in iOS nothing appears,I am using an iPhone iOS 16 emulator

To Reproduce 01 - MauiProgram.cs

.UseLocalNotification(config =>
{
   config.AddiOS(iOS =>
   {
      iOS.SetPermission(new iOSNotificationPermission
      {
         LocationAuthorization = iOSLocationAuthorization.WhenInUse
      });
  });
})

02 - add permission to Info.plist Privacy - Location When In Use Usage Description

03 - Schedule Notification

if (marktingsAdList.Count() > 0)
            {
                var ScheduleTime = DateTime.Now;
                var NotifiId = 0;
                foreach (var item in marktingsAdList)
                {
                    ScheduleTime = ScheduleTime.AddSeconds(1);
                    NotifiId++;
                    var notify = new NotificationRequest
                    {
                        BadgeNumber = NotifiId,
                        NotificationId = NotifiId,
                        Subtitle = "الجميع أونلاين ",
                        Title = item.Title,
                        Description = item.Kind,
                        CategoryType = NotificationCategoryType.Service,

                        Schedule = new NotificationRequestSchedule
                        {
                            NotifyTime = ScheduleTime,
                        },

                        Android = new Plugin.LocalNotification.AndroidOption.AndroidOptions
                        {
                            IsProgressBarIndeterminate = true,
                            VisibilityType = Plugin.LocalNotification.AndroidOption.AndroidVisibilityType.Private,
                            LedColor = 1,
                        }
                    };

                    LocalNotificationCenter.Current.Show(notify);
                }
            }

Expected behavior A notification is expected to appear in the emulator system, but nothing appears !!

Platform (please complete the following information):

  • OS: iOS
  • Version 16.1

Smartphone (please complete the following information):

  • Device: iPhone 14 Simulator
  • OS: iOS16.1

Issue Analytics

  • State:closed
  • Created 10 months ago
  • Comments:9 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
EntityBoxcommented, Feb 11, 2023

@ZacharyThomasStone , remember that you have 2 instances for the messages to show:

  1. Foreground - Application is running and open - iOS will not show the message when you in this mode, you must handle the incoming message based on the += NotificationReceived eventhandler from the DI instance. eg: push an Alert popup on the MainThread to display the message.

  2. Background - this is when you minimized or closed the app, now for debugging, I’ve used just the minimize, the OnSleep in App.cs is called and VS still runs in debug mode. Push the message request with your schedule set to 30seconds from the .Show() method, sleep the device, and wait for it to appear.

I’ve tested with just the default .UseLocalNotification() in MauiProgram.cs running .net-6.0. Hope this helps.

0reactions
thudugalacommented, Jun 17, 2023
Read more comments on GitHub >

github_iconTop Results From Across the Web

Notifications on my iPhone are not working
Notifications on my iPhone are not working. No longer receive notifications on apps that I set up to receive them except iMessage and...
Read more >
How to Fix Notifications Not Working on iPhone and iPad
You can go to Settings > Focus > Do Not Disturb to turn it off and check whether you can receive notifications again....
Read more >
Notifications not working in iOS 16? 9 Ways to fix it!
Notifications not working in iOS 16? 9 Ways to fix it! · 1. Turn off Focus on iPhone · 2. Add exceptions to...
Read more >
How To Fix Not Getting Notifications on an iPhone
Method No. 1 – Restart Your iPhone Method No. 2 – Check Your Notification Settings Method No. 3 – Disable Focus Mode Method...
Read more >
iPhone Notifications Not Working: 5 Ways to Fix It
Make sure notifications are turned on · 1. Open the Settings app. · 2. Tap Notifications. · 3. Tap on Show Previews at...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found