package com.ui.yogeshblogspot; import android.app.Activity; import android.content.Context; import android.os.Bundle; import android.telephony.TelephonyManager; import android.widget.TextView; public class Main extends Activity { /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); //Getting the Object of TelephonyManager TelephonyManager tManager = (TelephonyManager)getSystemService(Context.TELEPHONY_SERVICE); //Getting the SIM card ID String simId=tManager.getSimSerialNumber(); //Getting Phone Number String tnumber=tManager.getLine1Number(); //Getting IMEI Number of Devide String Imei=tManager.getDeviceId(); TextView s=(TextView)findViewById(R.id.simid);//Getting TexView from main.xml to Display SIM Card Id s.setText("Sim id - "+simId);//Displaying SIM card Id in the TextView TextView t=(TextView)findViewById(R.id.phoneno);//getting TextView from main.xml to display Phone Number t.setText("Phone No - "+tnumber);//Displaying the Phone Number. TextView i=(TextView)findViewById(R.id.imeino);//Getting the TextView to display IMEI number t.setText("IMEI number - "+Imei);//Displaying IMEI number } }
Wednesday, November 19, 2014
Getting sim serial number, phone number and IMEI in android
Labels:
Android
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment