-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Updating a notification channel seems not possible #1246
Comments
What were you trying to change though. Not sure I've missed something from what you've explained but Android itself doesn't allow for changing the majority of the notification channel details once created beyond the name and description as explained in https://developer.android.com/training/notify-user/channels |
Oh, sorry I didn't mention that. My app is listening for the devices current locale settings (in the "standard flutter way" with a localizations delegate) and localizes the channels name and description, so I need to update them. |
This is likely an oversight from when there was a contribution that added supported for creating notification channels and refactored some existing logic. This could probably be fixed by not bothering with specifying the channel action and some tweaks to the logic on the Android side. However, I've already got a few PRs to review including one from you so not something I could look into soon. If you've got time to look into submitting a PR for this then would happily at this ahead of the foreground service one if needed |
Using
AndroidFlutterLocalNotificationsPlugin.createNotificationChannel
does not update the notification channel.This suprised me since the behavior of the native Android methods
flutter_local_notifications
is calling is to simply update a channel if a channel with the same key already exists.Digging deeper shows that
AndroidNotificationChannelAction
can be used to explicitly update an already existing channel. But unfortunately theAndroidNotificationChannel
class, which is the parameter for the above mentionedcreateNotificationChannel
, does not allow setting such an action, despite already serializing it correctly and passing it correctly to the java side, see this line:flutter_local_notifications/flutter_local_notifications/lib/src/platform_specifics/android/method_channel_mappers.dart
Line 59 in 63e2f27
I would opt for making this action a parameter in the
AndroidNotificationChannel
class and not forcing it toAndroidNotificationChannelAction.createIfNotExists
while serializing, so a developer has the control over what happens.My current workaround is to delete all channels and recreate them.
The text was updated successfully, but these errors were encountered: