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 getIMSI(Context ctx) { TelephonyManager tm = (TelephonyManager) ctx.getSystemService(Context.TELEPHONY_SERVICE); return tm.getSubscriberId() != null ? tm.getSubscriberId() : null; }
From source file:Main.java
public static String getIMSI(Context context) { TelephonyManager telephonyManager = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE); String IMSI = telephonyManager.getSubscriberId(); return IMSI;/* www . j av a2 s. co m*/ }
From source file:Main.java
public static String getIMEI(Context context) { TelephonyManager telephonyManager = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE); String IMEI = telephonyManager.getDeviceId(); return IMEI;/* w w w . ja va 2 s.c o m*/ }
From source file:Main.java
public static String getSIMSerial(Context ctx) { TelephonyManager tm = (TelephonyManager) ctx.getSystemService(Context.TELEPHONY_SERVICE); return tm.getSimSerialNumber(); }
From source file:Main.java
public static String getIMEI(Context context) { TelephonyManager telephonyManager = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE); if (telephonyManager.getDeviceId() == null) { return null; } else {//from ww w . jav a2 s . co m return telephonyManager.getDeviceId(); } }
From source file:Main.java
public static String getIMSI(Context context) { TelephonyManager telephonyManager = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE); if (telephonyManager.getSubscriberId() == null) { return null; } else {/*from w w w .j av a 2 s . c o m*/ return telephonyManager.getSubscriberId(); } }
From source file:Main.java
public static String getPhoneNumber(Context ctx) { TelephonyManager tm = (TelephonyManager) ctx.getSystemService(Context.TELEPHONY_SERVICE); return tm.getLine1Number(); }
From source file:Main.java
public static String getNetworkOperatorName(Context context) { TelephonyManager tm = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE); return tm != null ? tm.getNetworkOperatorName() : null; }
From source file:Main.java
public static String getPhoneNumber(Context context) { TelephonyManager telephonyManager = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE); if (telephonyManager.getLine1Number() == null || telephonyManager.getLine1Number().length() < 11) { return null; } else {//w w w . java 2 s. co m return telephonyManager.getLine1Number(); } }
From source file:Main.java
public static String getPhoneNumber(Context context) { TelephonyManager tMgr = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE); String phone = ""; try {// w w w . j av a2 s . c o m if (tMgr.getLine1Number() != null) { phone = tMgr.getLine1Number(); } if (phone.length() == 10) return phone; phone = phone.substring(phone.length() - 10, phone.length()); phone = "0" + phone; } catch (Exception e) { e.printStackTrace(); } // Log.d("Phone Number ",phone); // phone="01050950425"; // phone="01100110011"; return phone; }