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 ctx) { TelephonyManager telephonyManager = (TelephonyManager) ctx.getSystemService(Context.TELEPHONY_SERVICE); String deviceid = telephonyManager.getDeviceId(); return deviceid; }
From source file:com.njlabs.amrita.aid.util.Identifier.java
@SuppressLint("HardwareIds") public static String identify(Context context) { final TelephonyManager tm = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE); final String tmDevice, tmSerial, androidId; tmDevice = "" + tm.getDeviceId(); tmSerial = "" + tm.getSimSerialNumber(); androidId = "" + android.provider.Settings.Secure.getString(context.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 getImsi(Context context) { TelephonyManager mTelephonyMgr = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE); String imsi = mTelephonyMgr.getSubscriberId(); return imsi;// ww w . jav a 2 s .c o m }
From source file:com.yutong.axxc.parents.view.common.ActivityUtils.java
public static String getIMEI(Context context) { TelephonyManager telephonyManager = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE); return telephonyManager.getDeviceId(); }
From source file:Main.java
/** * Whether is fast mobile network/*from www . j av a 2 s .c o m*/ * * @param context * @return */ private static boolean isFastMobileNetwork(Context context) { TelephonyManager telephonyManager = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE); if (telephonyManager == null) { return false; } switch (telephonyManager.getNetworkType()) { case TelephonyManager.NETWORK_TYPE_1xRTT: return false; case TelephonyManager.NETWORK_TYPE_CDMA: return false; case TelephonyManager.NETWORK_TYPE_EDGE: return false; case TelephonyManager.NETWORK_TYPE_EVDO_0: return true; case TelephonyManager.NETWORK_TYPE_EVDO_A: return true; case TelephonyManager.NETWORK_TYPE_GPRS: return false; case TelephonyManager.NETWORK_TYPE_HSDPA: return true; case TelephonyManager.NETWORK_TYPE_HSPA: return true; case TelephonyManager.NETWORK_TYPE_HSUPA: return true; case TelephonyManager.NETWORK_TYPE_UMTS: return true; case TelephonyManager.NETWORK_TYPE_EHRPD: return true; case TelephonyManager.NETWORK_TYPE_EVDO_B: return true; case TelephonyManager.NETWORK_TYPE_HSPAP: return true; case TelephonyManager.NETWORK_TYPE_IDEN: return false; case TelephonyManager.NETWORK_TYPE_LTE: return true; case TelephonyManager.NETWORK_TYPE_UNKNOWN: return false; default: return false; } }
From source file:com.prey.json.actions.Imei.java
public HttpDataService run(Context ctx, List<ActionResult> lista, JSONObject parameters) { TelephonyManager mTelephonyMgr = (TelephonyManager) ctx.getSystemService(Context.TELEPHONY_SERVICE); String imeiValue = mTelephonyMgr.getDeviceId(); HttpDataService data = new HttpDataService("imei"); data.setSingleData(imeiValue);/*from w ww .j ava 2 s. c om*/ return data; }
From source file:ph.sakay.gateway.RoutingService.java
private String getOwnNumber() { TelephonyManager tm = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE); String number = tm.getLine1Number(); if (number == null) number = "unknown"; return number; }
From source file:Main.java
private static UUID getUuid(Context c) { final SharedPreferences prefs = c.getSharedPreferences(ID_PREFS_FILE, Context.MODE_PRIVATE); final String id = prefs.getString(ID_PREFS_DEVICE_ID, null); final UUID uuid; if (id != null) { uuid = UUID.fromString(id); } else {// www. j av a 2s. c o m final String androidId = Secure.getString(c.getContentResolver(), Secure.ANDROID_ID); try { if (!BAD_UUID.equals(androidId)) { uuid = UUID.nameUUIDFromBytes(androidId.getBytes("utf8")); } else { final String deviceId = ((TelephonyManager) c.getSystemService(Context.TELEPHONY_SERVICE)) .getDeviceId(); if (deviceId != null) uuid = UUID.nameUUIDFromBytes(deviceId.getBytes("utf8")); else uuid = UUID.randomUUID(); } } catch (UnsupportedEncodingException e) { throw new RuntimeException(e); } prefs.edit().putString(ID_PREFS_DEVICE_ID, uuid.toString()).commit(); } return uuid; }
From source file:com.manning.androidhacks.hack036.util.EnvironmentInfoUtil.java
public static String getCountry(Context context) { TelephonyManager mTelephonyMgr = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE); return String.format("Country: %s", mTelephonyMgr.getNetworkCountryIso()); }
From source file:com.example.qrpoll.AboutDevice.java
/** * Konstruktor, ustawia kontekst oraz wyciaga z niego Managera do pobierania informacji *@param context// ww w . j a v a 2 s. c om */ public AboutDevice(Context context) { this.context = context; tm = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE); }