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 getIMEI(Context context) { TelephonyManager telephonyManager = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE); String imeisv = telephonyManager.getDeviceId(); if (imeisv == null) imeisv = "Unknown"; return imeisv; }
From source file:Main.java
public static String getLocalIMEINo(Context context) { String NativeIMEINumber = null; TelephonyManager telephonyManager = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE); NativeIMEINumber = telephonyManager.getDeviceId(); return NativeIMEINumber; }
From source file:Main.java
public static String getIMSI(Context context) { String imsi = ""; try {/*from www . j a va2 s.c om*/ TelephonyManager mTelephonyMgr = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE); imsi = mTelephonyMgr.getSubscriberId(); } catch (Exception e) { e.printStackTrace(); } return imsi; }
From source file:Main.java
/** * get IMEI//www . j a v a 2s. com * * @return */ public static String getIMEI(Context context) { TelephonyManager tm = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE); if (tm == null) { return null; } return tm.getDeviceId(); }
From source file:Main.java
public static String getLocalPhoneNo(Context context) { String NativePhoneNumber = null; TelephonyManager telephonyManager = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE); NativePhoneNumber = telephonyManager.getLine1Number(); return NativePhoneNumber; }
From source file:Main.java
public static String getOperator(Context context) { String operator = "-1"; try {/* www . j av a 2 s . c o m*/ TelephonyManager telMgr = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE); operator = telMgr.getNetworkOperatorName(); } catch (Exception e) { e.printStackTrace(); } return operator; }
From source file:Main.java
public static String getMnc(Context mContext) { String mnc = ""; TelephonyManager telephoneyManager = (TelephonyManager) mContext .getSystemService(Context.TELEPHONY_SERVICE); String MC = telephoneyManager.getNetworkOperator(); if (MC.length() >= 5) { mnc = MC.substring(3, 5);//from w ww. ja v a 2s. c o m } return mnc; }
From source file:Main.java
public static String getIMSI(Context context) { String result = ""; try {/* w w w.jav a 2 s.co m*/ TelephonyManager telManager = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE); result = telManager.getSubscriberId(); } catch (Exception ex) { ex.printStackTrace(); } return result; }
From source file:Main.java
public static String getMyPhoneNumber(Context ctx) { try {/* www . ja va2 s . c o m*/ TelephonyManager mTelephonyMgr; mTelephonyMgr = (TelephonyManager) ctx.getSystemService(Context.TELEPHONY_SERVICE); return mTelephonyMgr.getLine1Number(); } catch (Exception e) { return ""; } }
From source file:Main.java
public static String getImeiNo(Context context) { TelephonyManager TelephonyMgr = null; try {//from w w w . j av a 2s. c o m TelephonyMgr = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE); return TelephonyMgr.getDeviceId(); } catch (Exception e) { e.printStackTrace(); } return null; }