My Android application needs to react differently to different Mobile Country Codes.
It seems like it is hardcoded to mcc310 (US). I can read this value from TelephonyManager.getSimCountryIso()
or by using a resource folder like res/values-mcc123/
but how do I set this value in the emulator?
To change what TelephonyManager.getSimCountryIso()
returns, simply execute
adb shell setprop gsm.sim.operator.iso-country no
and it now returns no (Norway).
If you want to change what TelephonyManager.getSimOperator()
returns (MCC+MNC) then execute
adb shell setprop gsm.sim.operator.numeric 24201
and you have changed MCC to 242 (Norway) and MNC to 01 (Telenor).
To see which other properties you can change then execute
adb shell getprop
This is verified to work on both AVD and Genymotion. However, this does not change these properties persistently.