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

前端 未结 7 1040
感情败类
感情败类 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:17

    I found out that network operator sometimes can be like 65@5 when not connected to the operator (service unavailable) even if there is a a SIM card inserted. This happened on Samsung S2 running Android 4.1.2.

    enter image description here

    So you have to be careful when converting to Int.

     int mcc = Integer.parseInt(networkOperator.substring(0, 3));
    
    0 讨论(0)
提交回复
热议问题