I am creating my first app on kotlin multi-platform, and a need to get some device's information like language and maybe country.
I am looking for a way to get on both devices, android and iOS, using Kotlin multi-plataform.
It is possible? Or it's only possible make this on native way on both devices?
Something like the following.
Common
expect val myLang:String?
expect val myCountry:String?
iOS
actual val myLang:String?
get() = NSLocale.currentLocale.languageCode
actual val myCountry:String?
get() = NSLocale.currentLocale.countryCode
Android
actual val myLang:String?
get() = Locale.getDefault().language
actual val myCountry:String?
get() = Locale.getDefault().country
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