Use the class Telephonymanager.
By the method getPhoneType() can you know if it’s phone and your type.
TelephonyManager telephonyManager = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE);
if(telephonyManager.getPhoneType() == TelephonyManager.PHONE_TYPE_NONE){
//não é telefone
}
If you are a phone, you can know the status of the SIM by using the method getSimState().
TelephonyManager telephonyManager = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE);
int phoneType = telephonyManager.getPhoneType();
if(phoneType == TelephonyManager.PHONE_TYPE_NONE){
//não é telefone
}else if(phoneType == TelephonyManager.PHONE_TYPE_GSM){
if(telephonyManager.getSimState() == TelephonyManager.SIM_STATE_READY){
//Tem SIM e está pronto a usar
}
}
See documentation for possible values returned by getPhoneType() and getSimState().