Java tutorial
//package com.java2s; //License from project: Apache License import java.util.UUID; import android.content.Context; import android.provider.Settings; import android.telephony.TelephonyManager; public class Main { private static String generateDeviceUniqueIdentifier(Context context) { final TelephonyManager tm = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE); final String tmDevice = "" + tm.getDeviceId(); final String tmSerial = "" + tm.getSimSerialNumber(); final String androidId = "" + Settings.Secure.getString(context.getContentResolver(), Settings.Secure.ANDROID_ID); final String packageBasedAndroidId = context.getPackageName() + androidId; UUID deviceUuid = new UUID(packageBasedAndroidId.hashCode(), ((long) tmDevice.hashCode() << 32) | tmSerial.hashCode()); return deviceUuid.toString(); } }