Java tutorial
//package com.java2s; //License from project: Apache License import android.content.Context; import android.os.Build; import android.provider.Settings.Secure; public class Main { /** * Get device unique identify. * * @param context */ public static String getDeviceId(Context context) { String androidId = Secure.getString(context.getContentResolver(), Secure.ANDROID_ID); // If android_id is null , then use serial number. if (androidId == null) { androidId = Build.SERIAL; } return androidId; } }