Android examples for Hardware:Device ID
This Function return the Android DeviceID in String format.
//package com.java2s; import android.content.Context; import android.telephony.TelephonyManager; public class Main { /**//from w w w. jav a 2 s . co m * 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; } }