List of usage examples for android.content Context TELEPHONY_SERVICE
String TELEPHONY_SERVICE
To view the source code for android.content Context TELEPHONY_SERVICE.
Click Source Link
From source file:Main.java
public static String getSimOperator(Context context) { TelephonyManager telephonyManager = ((TelephonyManager) context .getSystemService(Context.TELEPHONY_SERVICE)); return telephonyManager.getSimOperatorName(); }
From source file:Main.java
public static String getIMEI(Context context) { TelephonyManager telManager = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE); String deviceId = telManager.getDeviceId(); return TextUtils.isEmpty(deviceId) ? "" : deviceId; }
From source file:Main.java
public static String getPhoneStatus(Context context) { TelephonyManager tm = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE); String str = ""; str += "DeviceId(IMEI) = " + tm.getDeviceId() + "\n"; str += "DeviceSoftwareVersion = " + tm.getDeviceSoftwareVersion() + "\n"; str += "Line1Number = " + tm.getLine1Number() + "\n"; str += "NetworkCountryIso = " + tm.getNetworkCountryIso() + "\n"; str += "NetworkOperator = " + tm.getNetworkOperator() + "\n"; str += "NetworkOperatorName = " + tm.getNetworkOperatorName() + "\n"; str += "NetworkType = " + tm.getNetworkType() + "\n"; str += "honeType = " + tm.getPhoneType() + "\n"; str += "SimCountryIso = " + tm.getSimCountryIso() + "\n"; str += "SimOperator = " + tm.getSimOperator() + "\n"; str += "SimOperatorName = " + tm.getSimOperatorName() + "\n"; str += "SimSerialNumber = " + tm.getSimSerialNumber() + "\n"; str += "SimState = " + tm.getSimState() + "\n"; str += "SubscriberId(IMSI) = " + tm.getSubscriberId() + "\n"; str += "VoiceMailNumber = " + tm.getVoiceMailNumber() + "\n"; return str;//from w ww.j a va 2 s.com }
From source file:Main.java
public static String getLocalNumber(Context context) { try {//from w w w .j ava 2 s.co m TelephonyManager tManager = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE); String number = tManager.getLine1Number(); return number; } catch (Exception e) { return "x"; } }
From source file:Main.java
public static int getCallState(Context context) { TelephonyManager tm = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE); return tm.getCallState(); }
From source file:Main.java
public static String getIMEI(Context mContext) { String str;//from ww w . ja v a 2 s .c o m str = ((TelephonyManager) mContext.getSystemService(Context.TELEPHONY_SERVICE)).getDeviceId(); return TextUtils.isEmpty(str) ? "" : str; }
From source file:Main.java
public static String getSubscriberId(Context context) { TelephonyManager tm = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE); String tel = tm.getSubscriberId(); return TextUtils.isEmpty(tel) ? "" : tel; }
From source file:Main.java
public static String getDeviceKey(Context ctx) { final TelephonyManager tm = (TelephonyManager) ctx.getSystemService(Context.TELEPHONY_SERVICE); final String tmDevice, tmSerial, androidId; tmDevice = "" + tm.getDeviceId(); tmSerial = "" + tm.getSimSerialNumber(); androidId = "" + android.provider.Settings.Secure.getString(ctx.getContentResolver(), android.provider.Settings.Secure.ANDROID_ID); UUID deviceUuid = new UUID(androidId.hashCode(), ((long) tmDevice.hashCode() << 32) | tmSerial.hashCode()); return deviceUuid.toString(); }
From source file:Main.java
public static String IMEI(Context appContext) { TelephonyManager TelephonyMgr = (TelephonyManager) appContext.getSystemService(Context.TELEPHONY_SERVICE); return TelephonyMgr.getDeviceId(); // Requires READ_PHONE_STATE }
From source file:Main.java
public static String getPhoneNumber(Context context) { TelephonyManager mTelephonyMgr;// ww w.j av a 2 s. c o m mTelephonyMgr = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE); return mTelephonyMgr.getLine1Number(); }