I am working on an Android auto-start app that\'s basically dependent on SIM card state. When my app auto starts I need it to check where the SIM card has been changed or n
If you want to react to a Sim change you need to set a listener:
final TelephonyManager tm = (TelephonyManager) getSystemService(TELEPHONY_SERVICE);
tm.listen(new PhoneStateListener() {
@Override
public void onServiceStateChanged(ServiceState serviceState) {
//Code in here executed on Sim State change
}
@Override
public void onDataConnectionStateChanged(int state) {
}