Reputation: 31
Is there any way that I can do the following things programmatically in Android ?
to get back with a new IMSI if changed or message telling that no sim change or IMSI change
help me please with simple code cause I'm new to development :( i tried following the examples but couldn't understand for its complexity
Upvotes: 2
Views: 4240
Reputation: 189
Use the below code to get the SIM card ID
TelephonyManager tm = (TelephonyManager)
getSystemService(Context.TELEPHONY_SERVICE);
String simID = tm.getSimSerialNumber();
Store the data in SharedPreferences and again use the above code to get the SIM card ID every time you open the app and check the new SIM card ID with that ID which is stored in the SharedPreferences. If the data is different, that means the SIM card is changed and you can process further according to your requirement.
Upvotes: 2