//获取机器的唯一id
public static String getDeviceID() {
String deviceID= "";
try{
//一共13位 如果位数不够可以继续添加其他信息
deviceID= ""+Build.BOARD.length() % 10 + Build.BRAND.length() % 10 +
Build.CPU_ABI.length() % 10 + Build.DEVICE.length() % 10 +
Build.DISPLAY.length() % 10 + Build.HOST.length() % 10 +
Build.ID.length() % 10 + Build.MANUFACTURER.length() % 10 +
Build.MODEL.length() % 10 + Build.PRODUCT.length() % 10 +
Build.TAGS.length() % 10 + Build.TYPE.length() % 10 +
Build.USER.length() % 10;
}catch (Exception e){
return "";
}
return deviceID;
}
public static void getid() {
//获取时间
String yyyyMMdd_hHmmss = new SimpleDateFormat("yyyyMMddHHmmss").format(new Date());
//生成10到99的随机数
int min = 10;
int max = 99;
Random random = new Random();
int num = random.nextInt(max)%(max-min+1) + min;
ry = yyyyMMdd_hHmmss+ num;
Log.e("TAG","当前时间加两位的随机数:"+ ry);
}