I have a function that launches the intent that op...
# android
d
I have a function that launches the intent that opens the language settings for my app. I select the desired language and it automatically goes back to my app. But the language has not changed, and the only way to make it change is the to manually relaunch the app. How can I make the language change in the settings instantly reflect in the app?
not kotlin but kotlin colored 3
Copy code
actual fun openLanguageSettings(localUriHandler: UriHandler) {
        val packageName = "..."
        val intent = Intent(Settings.ACTION_APP_LOCALE_SETTINGS)
        intent.data = "package:$packageName".toUri()

        intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)

        context.startActivity(intent)
    }
d
Not much new info in there.
onConfigurationChanged
does get called when I change the language in the settings and the newConfig contains the new locale. As far as I understand that should recreate the activity with the new locale, but it doesn't.
m
Check the android manifest if the tags for the language change are targetet to the newest api version. check this url 🙂 https://android-developers.googleblog.com/2022/11/per-app-language-preferences-part-1.html
d
Could you elaborate, I didn't really understand what you mean?
c
And that’s exactly where this workspace comes to it’s ends. You have an issue with Android . We are here for issues with Kotlin. 😄
d
Got it. Seems like it also started randomly working today, I have no clue what changed...
😃 1
w
you should use flows state because many event happen to collect the last change and note live data in viewmodel
👎🏼 1
c
A configuration change is not a flow 🤣
👍 1