/*
* File: DeviceUtils.java
* Author: wenxiangli
* Create: 2017/8/17 16:22
* 获取手机的UUID信息
*/
import android.content.Context;
import android.telephony.TelephonyManager;
import java.util.UUID;
public class DeviceUtils {
protected volatile static String uniqueId;
public static String getUniqueID(Context context){
final TelephonyManager tm = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
final String tmDevice, tmSerial, androidId;
tmDevice = "" + tm.getDeviceId();
tmSerial = "" + tm.getSimSerialNumber();
androidId = "" + android.provider.Settings.Secure.getString(context.getContentResolver(), android.provider.Settings.Secure.ANDROID_ID);
UUID deviceUuid = new UUID(androidId.hashCode(), ((long)tmDevice.hashCode() << 32) | tmSerial.hashCode());
return uniqueId = deviceUuid.toString();
}
}
Android 获取手机的UUID
最新推荐文章于 2024-11-25 21:20:03 发布