Wednesday, 21 September 2011

Android Device Information

Android provides some classes and methods by which we can get the information of android devices. some examaples are given bellow.

Get sim serial number:

TelephonyManager tm = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE);
String getSimSerialNumber=tm.getSimSerialNumber();

Get Device ID :

TelephonyManager tManager = (TelephonyManager)myActivity.getSystemService(Context.TELEPHONY_SERVICE);
String uid = tManager.getDeviceId();

Get Ram size :

MemoryInfo mi = new MemoryInfo();
ActivityManager activityManager = (ActivityManager) getSystemService(ACTIVITY_SERVICE);
activityManager.getMemoryInfo(mi);
long availableMegs = mi.availMem / 1048576L;

Get Manufacture info:


String m = Build.MANUFACTURER;
 

Get Networkoperator & SIM operator name:
String m = Build.MANUFACTURER;

TelephonyManager telephonyManager =((TelephonyManager) Context.getSystemService(Context.TELEPHONY_SERVICE));

//<------------ Network Operator-----------------

String operatorName = telephonyManager.getNetworkOperatorName();

//<------------SIM Operator------------
String operatorName = telephonyManager.getSimOperatorName();


Sim number:


mPhoneNumber = telephonyManager.getLine1Number();


Get Network Type :

if(telephonyManager.getNetworkType() == TelephonyManager.NETWORK_TYPE_UMTS)
Log.v(TAG, "3G");

if(telephonyManager.getNetworkType() == TelephonyManager.NETWORK_TYPE_EDGE )
Log.v(TAG, "GSM");

if(telephonyManager.getNetworkType() == TelephonyManager.TelephonyManager.NETWORK_TYPE_CDMA)
 Log.v(TAG, "CDMA");


 

No comments:

Post a Comment