How do I change the Mobile Country Code (MCC) in the Android Emulator?

后端 未结 6 497
隐瞒了意图╮
隐瞒了意图╮ 2020-12-25 08:18

My Android application needs to react differently to different Mobile Country Codes.

It seems like it is hardcoded to mcc310 (US). I can read thi

6条回答
  •  被撕碎了的回忆
    2020-12-25 09:04

    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.

提交回复
热议问题