how do you get the phone's MCC and MNC in Android?

前端 未结 7 1063
感情败类
感情败类 2020-12-04 11:18

The only way I\'ve found of retrieving MCC and MNC is by overriding an activity\'s onConfigurationChanged method, as such:

public void onConfigurationChanged         


        
7条回答
  •  忘掉有多难
    2020-12-04 12:14

    getResources().getConfiguration().mcc is a bad choice because it returns an integer, hence compromising valid values such as 01, or 044. Clearly integer is not a good option for this.

    See details in Mobile_Network_Code

    Update: in Australia, we verified a wrong case here. The getNetworkOperator returns different value from getSimOperator, where the latter is correct.

    See details in Android doc: TelephonyManager

提交回复
热议问题