Wednesday, 1 April 2009

Get Cell Info (Device ID,Subscriber ID)

Hi Android Developers,
For getting cell information and device information following data can help you.
String IMSI = android.os.SystemProperties.get(android.telephony.TelephonyProperties.PROPERTY_IMSI);
String IMEI = android.os.SystemProperties.get(android.telephony.TelephonyProperties.PROPERTY_IMEI);

******************* OR *************************

Can write the code in a Activity class to get info....

TelephonyManager mTelephonyMgr = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE);
String imsi = mTelephonyMgr.getSubscriberId();
String imei = mTelephonyMgr.getDeviceId();

Do not forget to set 'uses-permission android:name="android.permission.READ_PHONE_STATE"' in AndroidManifest.xml.