Example usage for android.content Context TELEPHONY_SERVICE

List of usage examples for android.content Context TELEPHONY_SERVICE

Introduction

In this page you can find the example usage for android.content Context TELEPHONY_SERVICE.

Prototype

String TELEPHONY_SERVICE

To view the source code for android.content Context TELEPHONY_SERVICE.

Click Source Link

Document

Use with #getSystemService(String) to retrieve a android.telephony.TelephonyManager for handling management the telephony features of the device.

Usage

From source file:Main.java

public static String getDeviceId(Context context) {
    String deviceId;/*from ww w .ja v  a  2 s  . co  m*/
    TelephonyManager tm = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
    deviceId = tm.getDeviceId();
    return deviceId;
}

From source file:Main.java

public static String getImei(Context context) {
    TelephonyManager tm = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
    Log.i("IMEI", tm.getDeviceId());
    return tm.getDeviceId();
}

From source file:Main.java

public static String getDeviceId() {
    TelephonyManager tm = (TelephonyManager) mContext.getSystemService(Context.TELEPHONY_SERVICE);
    String deviceId = tm.getDeviceId();
    return deviceId;
}

From source file:Main.java

public static String getIMEI(Context context) {
    String deviceId = "";
    TelephonyManager tm = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
    deviceId = tm.getDeviceId();//from   ww  w  . j a  v  a2 s.co  m
    return deviceId;
}

From source file:Main.java

@Deprecated
public static boolean isCMCCSimCard(Context context) {
    TelephonyManager teleManager = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
    return teleManager.getSimOperator().equals("46000");
}

From source file:Main.java

public static boolean hasSimFeature(final Context context) {

    TelephonyManager telephonyManager1 = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);

    return telephonyManager1.getPhoneType() != TelephonyManager.PHONE_TYPE_NONE;

}

From source file:Main.java

public static String getIMEI() {
    TelephonyManager phoneManager = (TelephonyManager) sContext.getSystemService(Context.TELEPHONY_SERVICE);
    return phoneManager.getDeviceId();
}

From source file:Main.java

public static String getIMEI(Context context) {
    String imeiStr = ((TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE)).getDeviceId();
    if (TextUtils.isEmpty(imeiStr)) {
        imeiStr = "000000000000000";
    }//  ww w.  java2 s.  c  o m
    return imeiStr;
}

From source file:Main.java

public static String getImei() {
    TelephonyManager mTelephonyMgr = (TelephonyManager) mContext.getSystemService(Context.TELEPHONY_SERVICE);
    return mTelephonyMgr.getDeviceId();
}

From source file:Main.java

public static String getImsi() {
    TelephonyManager mTelephonyMgr = (TelephonyManager) mContext.getSystemService(Context.TELEPHONY_SERVICE);
    return mTelephonyMgr.getSubscriberId();
}