Tuesday, February 14, 2012

How to Check if Sim Card Exists in the android device?

It is very easy to check if the current phone has a sim card.  All you need to do is get a TelephonyManager and get the sim state.

TelephonyManager tm = (TelephonyManager) this.getSystemService(Context.TELEPHONY_SERVICE);  //gets the current TelephonyManager
if (tm.getSimState() != TelephonyManager.SIM_STATE_ABSENT){
  //the phone has a sim card
} else {
  //no sim card available
}

2 comments:

  1. I recommend using SIM_STATE_UNKNOWN because with your way a lot of tablets seem to think they have a sim card and even report an ID. I have no idea why but just my experience :)

    ReplyDelete

  2. hey nice post



    http://www.videocontelecom.com/prepaid-services.php

    ReplyDelete