Here you can find the source of getIMEI(Context context)
public static String getIMEI(Context context)
//package com.java2s; import android.content.Context; import android.provider.Settings.Secure; import android.telephony.TelephonyManager; import android.text.TextUtils; public class Main { /**//w w w.j a v a2 s . c o m * Get Device IMEI * * @author Sean Zheng * @CreateDate 2013-5-13 */ public static String getIMEI(Context context) { String imei = ""; TelephonyManager telephonyManager = (TelephonyManager) context .getSystemService(Context.TELEPHONY_SERVICE); if (telephonyManager != null) { imei = telephonyManager.getDeviceId(); if (TextUtils.isEmpty(imei)) { imei = Secure.getString(context.getContentResolver(), Secure.ANDROID_ID); } } return imei; } }