What exactly does TelephonyManager.getNetworkCountryIso() return?

断了今生、忘了曾经 提交于 2019-12-23 10:26:04

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!