Java tutorial
//package com.java2s; import android.content.Context; import android.telephony.TelephonyManager; public class Main { /** * get device id * @param context * @return */ public static String getDeviceId(Context context) { TelephonyManager telManager = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE); String deviceId = telManager.getDeviceId(); if (deviceId == null) { deviceId = new String("123456789012345"); } return deviceId; } }