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) {
    String deviceId;//  w ww . j  a va  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) {
    String deviceId = "";
    TelephonyManager tm = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
    deviceId = tm.getDeviceId();
    return deviceId;
}

From source file:Main.java

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

From source file:Main.java

private static String getSimNo(Context context) {
    TelephonyManager tm = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
    return tm.getDeviceId();
}

From source file:Main.java

public static String get_device_id() {
    TelephonyManager manager = (TelephonyManager) activity.getSystemService(Context.TELEPHONY_SERVICE);
    return manager.getDeviceId();
}

From source file:Main.java

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

From source file:Main.java

public static String getTelephonyMgr(Context context) {
    TelephonyManager tm = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
    String imei = tm.getDeviceId();
    return imei.toString();
}

From source file:Main.java

public static String getDeviceID(Context context) {
    TelephonyManager mTm = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
    String imei = mTm.getDeviceId();
    return imei;// w  w w  .  j av  a2s  .  c o  m
}

From source file:Main.java

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

From source file:Main.java

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