How can I check whether the Sim Card is available in an android device?

Viewed 56801

I need help checking whether a device has a sim card programatically. Please provide sample code.

4 Answers

Thanks @Arun kumar answer, kotlin version as below

fun isSIMInserted(context: Context): Boolean {
    return TelephonyManager.SIM_STATE_ABSENT != (context.getSystemService(Context.TELEPHONY_SERVICE) as TelephonyManager).simState
}
Related