From 2a56b88e1ba3b04b0161eb568fb35432506f0a22 Mon Sep 17 00:00:00 2001 From: Michael Bui <25263378+MaikuB@users.noreply.github.com> Date: Thu, 1 Jun 2023 22:12:59 +1000 Subject: [PATCH] updated tags used for Android Log.e calls (#2015) --- flutter_local_notifications/CHANGELOG.md | 1 + .../FlutterLocalNotificationsPlugin.java | 9 +++++---- .../ScheduledNotificationReceiver.java | 2 +- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/flutter_local_notifications/CHANGELOG.md b/flutter_local_notifications/CHANGELOG.md index 119786f39..efd28b530 100644 --- a/flutter_local_notifications/CHANGELOG.md +++ b/flutter_local_notifications/CHANGELOG.md @@ -2,6 +2,7 @@ * **Breaking change** removed deprecated `schedule`, `showDailyAtTime` and `showWeeklyAtDayAndTime` methods. Notifications that were scheduled prior to this release should still work * **Breaking change** removed `Time` class +* [Android] updated tags used when writing error logs. For corrupt scheduled notifications and error is logged the tag is now `ScheduledNotifReceiver` instead of `ScheduledNotifReceiver`. When logging that exact alarm permissions have been revoked the the tag is now `FLTLocalNotifPlugin` instead of `notification` # [14.1.1] 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 4c2cc6657..6e7bcc175 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 @@ -117,6 +117,9 @@ public class FlutterLocalNotificationsPlugin static final String PAYLOAD = "payload"; static final String NOTIFICATION_ID = "notificationId"; static final String CANCEL_NOTIFICATION = "cancelNotification"; + + private static final String TAG = "FLTLocalNotifPlugin"; + private static final String SHARED_PREFERENCES_KEY = "notification_plugin_cache"; private static final String DISPATCHER_HANDLE = "dispatcher_handle"; private static final String CALLBACK_HANDLE = "callback_handle"; @@ -206,8 +209,7 @@ static void rescheduleNotifications(Context context) { scheduleNotification(context, notificationDetails, false); } } catch (ExactAlarmPermissionException e) { - // TODO: update tag used to match name of class - Log.e("notification", e.getMessage()); + Log.e(TAG, e.getMessage()); removeNotificationFromCache(context, notificationDetails.id); } } @@ -225,8 +227,7 @@ static void scheduleNextNotification(Context context, NotificationDetails notifi removeNotificationFromCache(context, notificationDetails.id); } } catch (ExactAlarmPermissionException e) { - // TODO: update tag used to match name of class - Log.e("notification", e.getMessage()); + Log.e(TAG, e.getMessage()); removeNotificationFromCache(context, notificationDetails.id); } } 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 d68a72f12..ad2046fe2 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 @@ -20,7 +20,7 @@ @Keep public class ScheduledNotificationReceiver extends BroadcastReceiver { - private static final String TAG = "ScheduledNotificationReceiver"; + private static final String TAG = "ScheduledNotifReceiver"; @Override @SuppressWarnings("deprecation")