Java tutorial
//package com.java2s; //License from project: Open Source License import android.content.Context; import android.telephony.TelephonyManager; public class Main { /** * This Function return the Android DeviceID in String format. Always to add * following Permission in Manifest. * * Requires Permission: READ_PHONE_STATE * * See below for @params. */ public static String getDeviceID(Context ctx) { TelephonyManager telephonyManager = (TelephonyManager) ctx.getSystemService(Context.TELEPHONY_SERVICE); String iemi = telephonyManager.getDeviceId(); return iemi; } }