diff --git a/flutter_local_notifications/android/src/main/java/com/dexterous/flutterlocalnotifications/ForegroundService.java b/flutter_local_notifications/android/src/main/java/com/dexterous/flutterlocalnotifications/ForegroundService.java index cb646ca26..ce27856c2 100644 --- a/flutter_local_notifications/android/src/main/java/com/dexterous/flutterlocalnotifications/ForegroundService.java +++ b/flutter_local_notifications/android/src/main/java/com/dexterous/flutterlocalnotifications/ForegroundService.java @@ -11,10 +11,20 @@ public class ForegroundService extends Service { @Override + @SuppressWarnings("deprecation") public int onStartCommand(Intent intent, int flags, int startId) { - ForegroundServiceStartParameter parameter = - (ForegroundServiceStartParameter) - intent.getSerializableExtra(ForegroundServiceStartParameter.EXTRA); + ForegroundServiceStartParameter parameter; + if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.TIRAMISU) { + parameter = + (ForegroundServiceStartParameter) + intent.getSerializableExtra( + ForegroundServiceStartParameter.EXTRA, ForegroundServiceStartParameter.class); + } else { + parameter = + (ForegroundServiceStartParameter) + intent.getSerializableExtra(ForegroundServiceStartParameter.EXTRA); + } + Notification notification = FlutterLocalNotificationsPlugin.createNotification(this, parameter.notificationData); if (parameter.foregroundServiceTypes != null diff --git a/flutter_local_notifications/android/src/main/java/com/dexterous/flutterlocalnotifications/ScheduledNotificationBootReceiver.java b/flutter_local_notifications/android/src/main/java/com/dexterous/flutterlocalnotifications/ScheduledNotificationBootReceiver.java index cb619a708..d0a745d52 100644 --- a/flutter_local_notifications/android/src/main/java/com/dexterous/flutterlocalnotifications/ScheduledNotificationBootReceiver.java +++ b/flutter_local_notifications/android/src/main/java/com/dexterous/flutterlocalnotifications/ScheduledNotificationBootReceiver.java @@ -9,6 +9,7 @@ @Keep public class ScheduledNotificationBootReceiver extends BroadcastReceiver { @Override + @SuppressWarnings("deprecation") public void onReceive(final Context context, Intent intent) { String action = intent.getAction(); if (action != null) { diff --git a/flutter_local_notifications/android/src/main/java/com/dexterous/flutterlocalnotifications/ScheduledNotificationReceiver.java b/flutter_local_notifications/android/src/main/java/com/dexterous/flutterlocalnotifications/ScheduledNotificationReceiver.java index 92e4d3758..abdbdaa54 100644 --- a/flutter_local_notifications/android/src/main/java/com/dexterous/flutterlocalnotifications/ScheduledNotificationReceiver.java +++ b/flutter_local_notifications/android/src/main/java/com/dexterous/flutterlocalnotifications/ScheduledNotificationReceiver.java @@ -25,7 +25,12 @@ public void onReceive(final Context context, Intent intent) { intent.getStringExtra(FlutterLocalNotificationsPlugin.NOTIFICATION_DETAILS); if (StringUtils.isNullOrEmpty(notificationDetailsJson)) { // This logic is needed for apps that used the plugin prior to 0.3.4 - Notification notification = intent.getParcelableExtra("notification"); + Notification notification; + if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.TIRAMISU) { + notification = intent.getParcelableExtra("notification", Notification.class); + } else { + notification = intent.getParcelableExtra("notification"); + } notification.when = System.currentTimeMillis(); int notificationId = intent.getIntExtra("notification_id", 0); NotificationManagerCompat notificationManager = NotificationManagerCompat.from(context); diff --git a/flutter_local_notifications/example/linux/flutter/generated_plugin_registrant.cc b/flutter_local_notifications/example/linux/flutter/generated_plugin_registrant.cc index f6f23bfe9..e71a16d23 100644 --- a/flutter_local_notifications/example/linux/flutter/generated_plugin_registrant.cc +++ b/flutter_local_notifications/example/linux/flutter/generated_plugin_registrant.cc @@ -6,10 +6,6 @@ #include "generated_plugin_registrant.h" -#include void fl_register_plugins(FlPluginRegistry* registry) { - g_autoptr(FlPluginRegistrar) url_launcher_linux_registrar = - fl_plugin_registry_get_registrar_for_plugin(registry, "UrlLauncherPlugin"); - url_launcher_plugin_register_with_registrar(url_launcher_linux_registrar); } diff --git a/flutter_local_notifications/example/linux/flutter/generated_plugins.cmake b/flutter_local_notifications/example/linux/flutter/generated_plugins.cmake index f16b4c342..2e1de87a7 100644 --- a/flutter_local_notifications/example/linux/flutter/generated_plugins.cmake +++ b/flutter_local_notifications/example/linux/flutter/generated_plugins.cmake @@ -3,7 +3,6 @@ # list(APPEND FLUTTER_PLUGIN_LIST - url_launcher_linux ) list(APPEND FLUTTER_FFI_PLUGIN_LIST diff --git a/flutter_local_notifications/example/macos/Flutter/GeneratedPluginRegistrant.swift b/flutter_local_notifications/example/macos/Flutter/GeneratedPluginRegistrant.swift index 2d16ee4c8..0a6255f2a 100644 --- a/flutter_local_notifications/example/macos/Flutter/GeneratedPluginRegistrant.swift +++ b/flutter_local_notifications/example/macos/Flutter/GeneratedPluginRegistrant.swift @@ -10,7 +10,6 @@ import flutter_local_notifications import flutter_native_timezone import path_provider_macos import shared_preferences_macos -import url_launcher_macos func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) { DeviceInfoPlusMacosPlugin.register(with: registry.registrar(forPlugin: "DeviceInfoPlusMacosPlugin")) @@ -18,5 +17,4 @@ func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) { FlutterNativeTimezonePlugin.register(with: registry.registrar(forPlugin: "FlutterNativeTimezonePlugin")) PathProviderPlugin.register(with: registry.registrar(forPlugin: "PathProviderPlugin")) SharedPreferencesPlugin.register(with: registry.registrar(forPlugin: "SharedPreferencesPlugin")) - UrlLauncherPlugin.register(with: registry.registrar(forPlugin: "UrlLauncherPlugin")) }