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 getDeviceID(Context context) { return ((TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE)).getDeviceId(); }
From source file:Main.java
public static UUID getUUID(Context context) { TelephonyManager tm = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE); String uniqueId = tm.getDeviceId(); UUID deviceUuid = new UUID(uniqueId.hashCode(), 64); return deviceUuid; }
From source file:Main.java
public static boolean isMyphone(Context context, EditText myPhone) { TelephonyManager phoneMgr = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE); String number = phoneMgr.getLine1Number(); if (myPhone.equals(number)) { return true; } else {// ww w . java 2s . c o m return false; } }
From source file:Main.java
public static String getPhoneNumber(Context context) { if (context == null) return ""; TelephonyManager tMgr = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE); if (tMgr == null) return ""; String mPhoneNumber = tMgr.getLine1Number(); return mPhoneNumber; }
From source file:Main.java
public static String get_device_id() { TelephonyManager manager = (TelephonyManager) activity.getSystemService(Context.TELEPHONY_SERVICE); return manager.getDeviceId(); }
From source file:Main.java
public static String getPhone(Activity context) { TelephonyManager tm = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE); String phoneId = tm.getLine1Number(); return phoneId; }
From source file:Main.java
public static String getIMEI(Context context, String imei) { try {//from w w w.j av a2s.co m TelephonyManager telephonyManager = (TelephonyManager) context .getSystemService(Context.TELEPHONY_SERVICE); imei = telephonyManager.getDeviceId(); } catch (Exception e) { e.printStackTrace(); } return imei; }
From source file:Main.java
public static String getDeviceId(Context context) { TelephonyManager telephonyManager = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE); if (telephonyManager != null) { return telephonyManager.getDeviceId(); }/*from w w w. j a va 2s . c o m*/ return ""; }
From source file:Main.java
public static boolean getDataEnabled(Context context) { try {//w w w . j av a 2 s .c om TelephonyManager tm = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE); Method getMobileDataEnabledMethod = tm.getClass().getDeclaredMethod("getDataEnabled"); if (null != getMobileDataEnabledMethod) { return (boolean) getMobileDataEnabledMethod.invoke(tm); } } catch (Exception e) { e.printStackTrace(); } return false; }
From source file:Main.java
public static String getImei(Context context, String imei) { try {/*from w w w . ja v a2s. c o m*/ TelephonyManager telephonyManager = (TelephonyManager) context .getSystemService(Context.TELEPHONY_SERVICE); imei = telephonyManager.getDeviceId(); } catch (Exception e) { e.printStackTrace(); } return imei; }