Android examples for Hardware:Device Feature
Get Device IMEI
//package com.java2s; import android.content.Context; import android.provider.Settings.Secure; import android.telephony.TelephonyManager; import android.text.TextUtils; public class Main { /**/*from w w w .j ava2 s .com*/ * 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; } }