@@ -0,0 +1,1454 @@
+package com.cooler.util;%0A%0Aimport android.annotation.SuppressLint;%0Aimport android.content.Context;%0Aimport android.provider.Settings.Secure;%0A%0Aimport java.math.BigInteger;%0Aimport java.security.SecureRandom;%0A%0A/**%0A * UDID util: generate udid.%0A * %0A * @author Vincent Cheung%0A * @since  Dec. 11, 2014%0A */%0Apublic class Udid %7B%0A%09private static Udid sInstance;%0A%09private static String sUdid = null;%0A%09%0A%09private Context mContext;%0A%09%0A%09/** keep single instance */%0A%09private Udid(Context context) %7B%0A%09%09mContext = context;%0A%09%7D%0A%09%0A%09/**%0A%09 * Get the global instance.%0A%09 * %0A%09 * @param context you current context%0A%09 */%0A%09public static Udid with(Context context) %7B%0A%09%09synchronized (Udid.class) %7B%0A%09%09%09if (sInstance == null) %7B%0A%09%09%09%09sInstance = new Udid(context);%0A%09%09%09%7D%0A%09%09%7D%0A%09%09%0A%09%09return sInstance;%0A%09%7D%0A%09%0A%09/**%0A%09 * Get udid, this may spend some time, use thread if necessary.%0A%09 * %0A%09 * @return udid%0A%09 */%0A%09public String fetch() %7B%0A%09%09generateOpenUdid();%0A%09%09return sUdid;%0A%09%7D%0A%0A%09/** generate udid */%0A%09@SuppressLint(%22TrulyRandom%22)%0A%09private void generateOpenUdid() %7B%0A%09%09/* Try to get the ANDROID_ID */%0A%09%09sUdid = Secure.getString(mContext.getContentResolver(), Secure.ANDROID_ID); %0A%09%09if (sUdid == null %7C%7C sUdid.equals(%229774d56d682e549c%22) %7C%7C sUdid.length() %3C 15 ) %7B%0A%09%09%09/**%0A%09%09%09 * if ANDROID_ID is null, or it's equals to the GalaxyTab %0A%09%09%09 * generic ANDROID_ID or bad, generates a new one%0A%09%09%09 */%0A%09%09%09final SecureRandom random = new SecureRandom();%0A%09%09%09sUdid = new BigInteger(64, random).toString(16);%0A%09%09%7D%0A    %7D%0A%7D%0A

add udid util