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 getAppDeviceId(Context context) {
    TelephonyManager tm = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
    String 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 getIMEI() {
    TelephonyManager phoneManager = (TelephonyManager) sContext.getSystemService(Context.TELEPHONY_SERVICE);
    return phoneManager.getDeviceId();
}

From source file:Main.java

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

From source file:Main.java

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

From source file:Main.java

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

From source file:Main.java

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

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 getIMEI(Context context) {
    TelephonyManager tm = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
    String deviceId = tm.getDeviceId();
    tm = null;//from   w  w w .  ja  v a2s .  co  m
    return deviceId;
}

From source file:Main.java

public static String IMEI(Context appContext) {
    TelephonyManager TelephonyMgr = (TelephonyManager) appContext.getSystemService(Context.TELEPHONY_SERVICE);
    return TelephonyMgr.getDeviceId(); // Requires READ_PHONE_STATE
}