Java tutorial
//package com.java2s; import android.content.Context; import android.provider.Settings; public class Main { public static String getAndroidId(Context ctx) { String androidId = Settings.Secure.getString(ctx.getContentResolver(), Settings.Secure.ANDROID_ID); if (androidId == null || androidId.equalsIgnoreCase("android_id") || androidId.equalsIgnoreCase("9774d56d682e549c")) { return null; } return androidId; } }