Java tutorial
//package com.java2s; //License from project: LGPL import android.annotation.SuppressLint; import android.content.Context; import android.telephony.TelephonyManager; import android.text.TextUtils; public class Main { static String getPhoneImei(Context context) { @SuppressLint("HardwareIds") String imei = ((TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE)).getDeviceId(); if (TextUtils.isEmpty(imei)) { imei = "na"; } return imei; } }