In my application, i'm changing language dynamically so if my is in foreground, notification language is coming properly but if i force close app notification is coming in device locale.
I've used following code to change context locale but after force close it is not working
fun wrapContext(context: Context?, locale: Locale): Context? {
if (context == null) return null
val configuration = context.resources.configuration
if (getSystemLocale(configuration) === locale) {
return context
}
setSystemLocale(configuration, locale)
val res = context.resources
res.updateConfiguration(configuration, res.displayMetrics)
return context.createConfigurationContext(configuration)
}
Any help would be appreciated.