Kotlin: TelephonyManager.networkCountryIso instead of TelephonyManager.getNetworkCountryIso()

53 Views Asked by At

I'm trying to develop an Android APP that manages telephony services. One of the first tasks I tried to implement is getting info from the phone/SIM. In https://developer.android.com/reference/kotlin/android/telephony/TelephonyManager (Kotlin) i can find the methods of the class and I see the getNetworkCountryIso() method to retrieve this info.

Somewhere in Internet I found an example of code that doesn't use this method but uses a prorpiety-like format:

val tm = getSystemService(TELEPHONY_SERVICE) as TelephonyManager

val networkCountryISO = tm.networkCountryIso

Where can I find this way to retrieve info?

0

There are 0 best solutions below