Example usage for android.telephony TelephonyManager getDeviceId

List of usage examples for android.telephony TelephonyManager getDeviceId

Introduction

In this page you can find the example usage for android.telephony TelephonyManager getDeviceId.

Prototype

@Deprecated
@SuppressAutoDoc 
@RequiresPermission(android.Manifest.permission.READ_PHONE_STATE)
public String getDeviceId() 

Source Link

Document

Returns the unique device ID, for example, the IMEI for GSM and the MEID or ESN for CDMA phones.

Usage

From source file:Main.java

public static String getDeviceID(Context context) {
    TelephonyManager tm = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
    String deviceID = tm.getDeviceId();
    return deviceID;
}

From source file:Main.java

public static String getDeviceID(Context context) {
    TelephonyManager mngr = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
    String deviceID = mngr.getDeviceId();
    return deviceID;
}

From source file:Main.java

public static String getPhoneIMEI(Context context) {
    TelephonyManager telephonyManager = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
    return telephonyManager.getDeviceId();
}

From source file:Main.java

public static String getImei(Context context, String imei) {
    TelephonyManager telephonyManager = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
    imei = telephonyManager.getDeviceId();
    return imei;/*from www  . j a v a2s. co  m*/
}

From source file:Main.java

public static boolean isEmulator(Context context) {
    TelephonyManager tm = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
    String imei = tm.getDeviceId();
    if (imei == null || imei.equals("000000000000000")) {
        return true;
    }/*from   w w  w .  j  a v  a2s. c  om*/
    return false;
}

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 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

/**
 * Returns the device ID/*  w  w  w  .jav  a2 s.c o  m*/
 *
 * @param context A valid context instance
 * @return the device ID
 */
@SuppressWarnings("unused")
public static String getDeviceId(Context context) {
    TelephonyManager manager = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);

    return manager.getDeviceId();
}

From source file:Main.java

public static String getDeviceId(Context context) {
    TelephonyManager tm = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
    String deviceId = tm.getDeviceId();
    if (deviceId == null) {
        deviceId = tm.getSubscriberId();
    }/*from   w  w  w  .  j  a  va  2 s.  co m*/
    return deviceId;
}

From source file:Main.java

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