From 2a4f898a4dc335cdf553d5c6758b06e3ad51c85a Mon Sep 17 00:00:00 2001 From: Simon Ser Date: Sun, 23 Oct 2022 03:56:45 +0200 Subject: [PATCH] Drop registerWith in Android plugin (#1745) registerWith() is a relic from Flutter embedding v1. --- .../FlutterLocalNotificationsPlugin.java | 19 +++---------------- 1 file changed, 3 insertions(+), 16 deletions(-) diff --git a/flutter_local_notifications/android/src/main/java/com/dexterous/flutterlocalnotifications/FlutterLocalNotificationsPlugin.java b/flutter_local_notifications/android/src/main/java/com/dexterous/flutterlocalnotifications/FlutterLocalNotificationsPlugin.java index 9c5e6b882..646c253db 100644 --- a/flutter_local_notifications/android/src/main/java/com/dexterous/flutterlocalnotifications/FlutterLocalNotificationsPlugin.java +++ b/flutter_local_notifications/android/src/main/java/com/dexterous/flutterlocalnotifications/FlutterLocalNotificationsPlugin.java @@ -191,15 +191,6 @@ public class FlutterLocalNotificationsPlugin private PermissionRequestListener callback; private boolean permissionRequestInProgress = false; - @SuppressWarnings("deprecation") - public static void registerWith(io.flutter.plugin.common.PluginRegistry.Registrar registrar) { - FlutterLocalNotificationsPlugin plugin = new FlutterLocalNotificationsPlugin(); - plugin.setActivity(registrar.activity()); - registrar.addNewIntentListener(plugin); - registrar.addRequestPermissionsResultListener(plugin); - plugin.onAttachedToEngine(registrar.context(), registrar.messenger()); - } - static void rescheduleNotifications(Context context) { ArrayList scheduledNotifications = loadScheduledNotifications(context); for (NotificationDetails scheduledNotification : scheduledNotifications) { @@ -1248,15 +1239,11 @@ private void setActivity(Activity flutterActivity) { this.mainActivity = flutterActivity; } - private void onAttachedToEngine(Context context, BinaryMessenger binaryMessenger) { - this.applicationContext = context; - this.channel = new MethodChannel(binaryMessenger, METHOD_CHANNEL); - this.channel.setMethodCallHandler(this); - } - @Override public void onAttachedToEngine(FlutterPluginBinding binding) { - onAttachedToEngine(binding.getApplicationContext(), binding.getBinaryMessenger()); + this.applicationContext = binding.getApplicationContext(); + this.channel = new MethodChannel(binding.getBinaryMessenger(), METHOD_CHANNEL); + this.channel.setMethodCallHandler(this); } @Override