#if NET7_0_OR_GREATER using Microsoft.Maui.LifecycleEvents; namespace gehGassi.LocalNotifications; public static class AppBuilderExtensions { /// /// /// /// /// public static MauiAppBuilder UseLocalNotifications(this MauiAppBuilder builder) { builder// https://learn.microsoft.com/en-us/dotnet/maui/fundamentals/app-lifecycle .ConfigureLifecycleEvents(events => { #if ANDROID events.AddAndroid(android => android .OnCreate((activity, bundle) => OnNotificationTapped(activity.Intent)) .OnNewIntent((activity, intent) => OnNotificationTapped(intent))); static void OnNotificationTapped(Android.Content.Intent intent) { gehGassi.LocalNotifications.Platforms.NotificationService.NotificationTapped(intent); } #elif IOS events.AddiOS(iOS => iOS.FinishedLaunching((app, options) => InitLocalNotifications(options))); static bool InitLocalNotifications(Foundation.NSDictionary options) { gehGassi.LocalNotifications.Platforms.NotificationService.Initialize(options: options); return true; } #endif }); return builder; } } #endif