问题
I want to find out which country the user is currently in, in the event that a data connection is not available (so Geocoder
doesn't work). I think I can do this on phones (not tablets) by using TelephonyManager.getNetworkCountryIso
, but I find the documentation is not quite clear enough for me. The documentation says:
Returns the ISO country code equivalent of the current registered operator's MCC (Mobile Country Code).
Availability: Only when user is registered to a network. Result may be unreliable on CDMA networks (use getPhoneType() to determine if on a CDMA network).
What is the precise meaning of current registered operator here? Does this simply mean the network which the user is currently connected to, wherever in the world they may be, independent of where their SIM is registered (the "home" network)?
And in what sense is the result unreliable on CDMA networks? Does this mean it may return null
, or give a non-null
but misleading or inaccurate result?
回答1:
I believe the MCC is dependent on where you are in the world. A lot of the world doesn't use CDMA, rendering your phone incapable of connection in some situations. I believe it just returns an inaccurate result in those cases.
来源:https://stackoverflow.com/questions/26789128/what-exactly-does-telephonymanager-getnetworkcountryiso-return