Home:ALL Converter>Change SIM country programmatically?

Change SIM country programmatically?

Ask Time:2020-07-11T22:20:52         Author:Panjeet

Json Formatter

How can I programmatically change the country & network of an Android phone's SIM without root access? I'm using this code to retrieve information:

TelephonyManager tm = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);

System.out.println(tm.getSimCountryIso()); // prints 'us', but I want it to be 'fr'
System.out.println(tm.getNetworkCountryIso()); // prints 'us, but I want it to be 'fr'

As my SIM card is from the USA, both of the outputs are us. How can I programmatically make the output be fr (France) for example?

Basically, I want to trick my smartphone into thinking its SIM's country & network is France, for example.

Something like this would be perfect but it doesn't exist:

tm.setSimCountryIso('fr')

tm.setNetworkCountryIso('fr')

Author:Panjeet,eproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/62850324/change-sim-country-programmatically
yy