I created a Notification Channel like this:
NotificationChannel channel = new NotificationChannel(CHANNEL_ID_FOOBAR, getContext().getString(R.string.notification_channel_foobar), NotificationManager.IMPORTANCE_DEFAULT);
notificationManager.createNotificationChannel(channel);
I provided different translations for R.string.notification_channel_foobar and the channel is created with the language being used at the time of the creation, hence if I eventually change the language of my device, that channel will remain in the old language. Is there a way to overcome this or is this a limitation, i.e. by design?
What Are Notification Channels on Android? “Notification Channels” were introduced in 2017 with Android 8.0 Oreo. The idea is that apps can group different types of notifications into “channels.” Each channel can then be turned on or off by the user. This all happens in the Android settings.
What Are the Benefits of Using Notification Channels? By adding notification channels to Android, Google allowed end users to control their receipt of push messages, so that they can be alerted to the types of messages they want most, while opting out of the ones that don't interest them.
To create a notification channel, follow these steps: Construct a NotificationChannel object with a unique channel ID, a user-visible name, and an importance level. Optionally, specify the description that the user sees in the system settings with setDescription() .
Starting with Android 8.0, apps are required to assign their notifications to so-called “notification channels”. These channels determine which signals (notification sound, light, vibration, etc.)
To apply the new language to your notification channel, you need to listen to the ACTION_LOCALE_CHANGED broadcast in your app and call createNotificationChannel again in your receiver.
Recreating the channels will update your strings to the new language (none of the other channel features will be modified). You can see it in the documentation.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With