Alex Rivera | Logout

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

Asked 2009-05-20T21:31:01.023
59

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

public void onConfigurationChanged(Configuration config)
{
    super.onConfigurationChanged(config);
    DeviceData.MCC = "" + config.mcc;
    DeviceData.MNC = ""  +config.mnc;
}

However, I need this data as soon as the app starts and can't wait for the user to switch the phone's orientation or equivalent to trigger this method. Is there a better way to access the current Configuration object?

Edit
Report

1 Answer

6

You can access the current configuration by getResources().getConfiguration() does the trick.

answered 2009-10-11T21:55:42.570

Your Answer