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 getSimSerialNumber(Context context) { String simSerialNumber = null; try {/*www . j av a 2 s.c om*/ TelephonyManager tm = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE); simSerialNumber = tm.getSimSerialNumber(); } catch (Exception e) { e.printStackTrace(); } return simSerialNumber; }
From source file:Main.java
public static String getDeviceId(Context context) { if (context != null) { try {//from w w w . jav a 2 s . c o m TelephonyManager tm = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE); String device_id = tm.getDeviceId(); return device_id; } catch (Exception e) { } } return null; }
From source file:Main.java
public static String getDeviceInfo(Context context) { TelephonyManager tm = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE); StringBuilder sb = new StringBuilder(); sb.append("\nDeviceId(IMEI) = " + tm.getDeviceId()); sb.append("\nDeviceSoftwareVersion = " + tm.getDeviceSoftwareVersion()); sb.append("\nLine1Number = " + tm.getLine1Number()); sb.append("\nNetworkCountryIso = " + tm.getNetworkCountryIso()); sb.append("\nNetworkOperator = " + tm.getNetworkOperator()); sb.append("\nNetworkOperatorName = " + tm.getNetworkOperatorName()); sb.append("\nNetworkType = " + tm.getNetworkType()); sb.append("\nPhoneType = " + tm.getPhoneType()); sb.append("\nSimCountryIso = " + tm.getSimCountryIso()); sb.append("\nSimOperator = " + tm.getSimOperator()); sb.append("\nSimOperatorName = " + tm.getSimOperatorName()); sb.append("\nSimSerialNumber = " + tm.getSimSerialNumber()); sb.append("\nSimState = " + tm.getSimState()); sb.append("\nSubscriberId(IMSI) = " + tm.getSubscriberId()); sb.append("\nVoiceMailNumber = " + tm.getVoiceMailNumber()); return sb.toString(); }
From source file:Main.java
public static String ConfigureGetIMSI(Context context) { if (null == context) { return ""; }/* w w w .jav a2s. c o m*/ TelephonyManager tm = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE); String imsi = tm.getSubscriberId(); if (imsi == null) imsi = ""; return imsi; }
From source file:Main.java
public static String ConfigureGetIMEI(Context context) { if (null == context) { return ""; }//w w w .j ava2 s . c om TelephonyManager tm = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE); String imei = tm.getDeviceId(); if (imei == null) imei = ""; return imei; }
From source file:Main.java
public static String configureGetIMSI(Context context) { if (null == context) { return ""; }/*from w ww . jav a 2s.c om*/ TelephonyManager tm = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE); String imsi = tm.getSubscriberId(); if (imsi == null) imsi = ""; return imsi; }
From source file:Main.java
public static String configureGetIMEI(Context context) { if (null == context) { return ""; }//from ww w . jav a 2 s.c o m TelephonyManager tm = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE); String imei = tm.getDeviceId(); if (imei == null) imei = ""; return imei; }
From source file:Main.java
public static void setDataEnabled(Context context, boolean enabled) { try {/*from w ww. ja v a 2s. com*/ TelephonyManager tm = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE); Method setMobileDataEnabledMethod = tm.getClass().getDeclaredMethod("setDataEnabled", boolean.class); if (null != setMobileDataEnabledMethod) { setMobileDataEnabledMethod.invoke(tm, enabled); } } catch (Exception e) { e.printStackTrace(); } }
From source file:Main.java
public static String getImei(Context context) { String imei = ""; try {/*from w w w . ja v a 2 s . c o 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 getIMEI() { checkNull();/* w w w . ja v a 2 s . co m*/ TelephonyManager telephonyManager = (TelephonyManager) matoContext .getSystemService(Context.TELEPHONY_SERVICE); String imei = telephonyManager.getDeviceId(); return imei == null ? "null" : imei; }