} else if (!(tm.getSimState() == TelephonyManager.SIM_STATE_ABSENT
|| (tm.getSimOperator())
.equals(getString(R.string.numeric_tmo)) || (tm
.getSimOperator()).equals(getString(R.string.numeric_att)))) {
// if SIM is present and is NOT a T-Mo network SIM,
// display Error message alert indicating to use SM SIM
showAlert(getString(R.string.insert_sm_dialog));
}// No SIM or SIM with T-Mo MNC MCC present
If I'm not mistaken, this code means that if you have a SIM card inserted, it will show the message. You're checking for SIM_STATE_ABSENT
, but negating it.
If
getSimState()
returns absent, then the whole thing istrue
, which is negated tofalse
.If
getSimState()
returns not absent, then it checks for TMO/ATT. If either of these are true, again, it's all negated tofalse
.
You should be able to fix this by moving the negation to the operator check:
} else if(tm.getSimState() == TelephonyManager.SIM_STATE_ABSENT
|| !(tm.getSimOperator().equals(getString(R.string.numeric_tmo))
|| (tm.getSimOperator().equals(getString(R.string.numeric_att)))) {
// show error
}