Hello,
I wonder if it's possible to check if the sim card on the device is installed on Android.
Hello,
I wonder if it's possible to check if the sim card on the device is installed on Android.
A quick lookup in the documentation reveals the TelephonyManager.getSimState()
function. It can be used like this:
final TelephonyManager telephony = (TelephonyManager)getSystemService(TELEPHONY_SERVICE);
if (telephony.getSimState() == TelephonyManager.SIM_STATE_READY) {
// ...
}
The value returned is one of the following:
SIM_STATE_UNKNOWN // Em transição entre dois estados
SIM_STATE_ABSENT
SIM_STATE_PIN_REQUIRED
SIM_STATE_PUK_REQUIRED
SIM_STATE_NETWORK_LOCKED
SIM_STATE_READY
You can also set a callback to notify you that the SIM situation changes:
telephony.listen(new PhoneStateListener() {
@Override
public void onServiceStateChanged(ServiceState serviceState) {
// Verifique aqui a situação do SIM
}
});