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 5e74f0a2e..3874fbb34 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 @@ -366,10 +366,6 @@ private static void saveScheduledNotifications( } private static void commitAsync(final SharedPreferences.Editor editor, final Result result) { - if (executor == null || handler == null) { - editor.commit(); - return; - } executor.execute( new Runnable() { @Override @@ -1411,7 +1407,11 @@ private void initialize(MethodCall call, Result result) { applicationContext.getSharedPreferences(SHARED_PREFERENCES_KEY, Context.MODE_PRIVATE); SharedPreferences.Editor editor = sharedPreferences.edit(); editor.putString(DEFAULT_ICON, defaultIcon); - commitAsync(editor, result); + if (executor != null && handler != null) { + commitAsync(editor, result); + } else { + editor.commit(); + } } /// Extracts the details of the notifications passed from the Flutter side and also validates that