|
|
@ -402,7 +402,7 @@ public class Util {
|
|
402
|
402
|
}
|
|
403
|
403
|
|
|
404
|
404
|
public static String generateDmpUrl(String url) {
|
|
405
|
|
url = url.replace("__OS__", "android");
|
|
|
405
|
/* url = url.replace("__OS__", "android");
|
|
406
|
406
|
String mac = getMac(MainApplication.context);
|
|
407
|
407
|
if (mac != null) {
|
|
408
|
408
|
mac = mac.replace(":", "");
|
|
|
@ -419,7 +419,7 @@ public class Util {
|
|
419
|
419
|
|
|
420
|
420
|
url = url.replace("__DVCBRAND__", Build.BRAND);
|
|
421
|
421
|
url = url.replace("__DVCMODEL__", Build.MODEL);
|
|
422
|
|
|
|
|
422
|
*/
|
|
423
|
423
|
return url;
|
|
424
|
424
|
}
|
|
425
|
425
|
|
|
|
@ -436,69 +436,69 @@ public class Util {
|
|
436
|
436
|
return udid;
|
|
437
|
437
|
}
|
|
438
|
438
|
|
|
439
|
|
/**
|
|
440
|
|
* 获取wifi的mac地址,适配到android Q
|
|
441
|
|
*
|
|
442
|
|
* @param paramContext
|
|
443
|
|
* @return
|
|
444
|
|
*/
|
|
445
|
|
private static String getMac(Context paramContext) {
|
|
446
|
|
try {
|
|
447
|
|
if (Build.VERSION.SDK_INT >= 23) {
|
|
448
|
|
String str = getMacMoreThanM(paramContext);
|
|
449
|
|
if (!TextUtils.isEmpty(str))
|
|
450
|
|
return str;
|
|
451
|
|
}
|
|
452
|
|
// 6.0以下手机直接获取wifi的mac地址即可
|
|
453
|
|
WifiManager wifiManager = (WifiManager) paramContext.getSystemService("wifi");
|
|
454
|
|
WifiInfo wifiInfo = wifiManager.getConnectionInfo();
|
|
455
|
|
if (wifiInfo != null)
|
|
456
|
|
return wifiInfo.getMacAddress();
|
|
457
|
|
} catch (Throwable throwable) {
|
|
458
|
|
throwable.printStackTrace();
|
|
459
|
|
}
|
|
460
|
|
return null;
|
|
461
|
|
}
|
|
462
|
|
|
|
463
|
|
/**
|
|
464
|
|
* android 6.0+获取wifi的mac地址
|
|
465
|
|
*
|
|
466
|
|
* @param paramContext
|
|
467
|
|
* @return
|
|
468
|
|
*/
|
|
469
|
|
private static String getMacMoreThanM(Context paramContext) {
|
|
470
|
|
try {
|
|
471
|
|
//获取本机器所有的网络接口
|
|
472
|
|
Enumeration enumeration = NetworkInterface.getNetworkInterfaces();
|
|
473
|
|
while (enumeration.hasMoreElements()) {
|
|
474
|
|
NetworkInterface networkInterface = (NetworkInterface) enumeration.nextElement();
|
|
475
|
|
//获取硬件地址,一般是MAC
|
|
476
|
|
byte[] arrayOfByte = networkInterface.getHardwareAddress();
|
|
477
|
|
if (arrayOfByte == null || arrayOfByte.length == 0) {
|
|
478
|
|
continue;
|
|
479
|
|
}
|
|
480
|
|
|
|
481
|
|
StringBuilder stringBuilder = new StringBuilder();
|
|
482
|
|
for (byte b : arrayOfByte) {
|
|
483
|
|
//格式化为:两位十六进制加冒号的格式,若是不足两位,补0
|
|
484
|
|
stringBuilder.append(String.format("%02X:", new Object[]{Byte.valueOf(b)}));
|
|
485
|
|
}
|
|
486
|
|
if (stringBuilder.length() > 0) {
|
|
487
|
|
//删除后面多余的冒号
|
|
488
|
|
stringBuilder.deleteCharAt(stringBuilder.length() - 1);
|
|
489
|
|
}
|
|
490
|
|
String str = stringBuilder.toString();
|
|
491
|
|
// wlan0:无线网卡 eth0:以太网卡
|
|
492
|
|
if (networkInterface.getName().equals("wlan0")) {
|
|
493
|
|
return str;
|
|
494
|
|
}
|
|
495
|
|
}
|
|
496
|
|
} catch (SocketException socketException) {
|
|
497
|
|
return null;
|
|
498
|
|
}
|
|
499
|
|
return null;
|
|
500
|
|
}
|
|
501
|
|
|
|
|
439
|
// /**
|
|
|
440
|
// * 获取wifi的mac地址,适配到android Q
|
|
|
441
|
// *
|
|
|
442
|
// * @param paramContext
|
|
|
443
|
// * @return
|
|
|
444
|
// */
|
|
|
445
|
// private static String getMac(Context paramContext) {
|
|
|
446
|
// try {
|
|
|
447
|
// if (Build.VERSION.SDK_INT >= 23) {
|
|
|
448
|
// String str = getMacMoreThanM(paramContext);
|
|
|
449
|
// if (!TextUtils.isEmpty(str))
|
|
|
450
|
// return str;
|
|
|
451
|
// }
|
|
|
452
|
// // 6.0以下手机直接获取wifi的mac地址即可
|
|
|
453
|
// WifiManager wifiManager = (WifiManager) paramContext.getSystemService("wifi");
|
|
|
454
|
// WifiInfo wifiInfo = wifiManager.getConnectionInfo();
|
|
|
455
|
// if (wifiInfo != null)
|
|
|
456
|
// return wifiInfo.getMacAddress();
|
|
|
457
|
// } catch (Throwable throwable) {
|
|
|
458
|
// throwable.printStackTrace();
|
|
|
459
|
// }
|
|
|
460
|
// return null;
|
|
|
461
|
// }
|
|
|
462
|
//
|
|
|
463
|
// /**
|
|
|
464
|
// * android 6.0+获取wifi的mac地址
|
|
|
465
|
// *
|
|
|
466
|
// * @param paramContext
|
|
|
467
|
// * @return
|
|
|
468
|
// */
|
|
|
469
|
// private static String getMacMoreThanM(Context paramContext) {
|
|
|
470
|
// try {
|
|
|
471
|
// //获取本机器所有的网络接口
|
|
|
472
|
// Enumeration enumeration = NetworkInterface.getNetworkInterfaces();
|
|
|
473
|
// while (enumeration.hasMoreElements()) {
|
|
|
474
|
// NetworkInterface networkInterface = (NetworkInterface) enumeration.nextElement();
|
|
|
475
|
// //获取硬件地址,一般是MAC
|
|
|
476
|
// byte[] arrayOfByte = networkInterface.getHardwareAddress();
|
|
|
477
|
// if (arrayOfByte == null || arrayOfByte.length == 0) {
|
|
|
478
|
// continue;
|
|
|
479
|
// }
|
|
|
480
|
//
|
|
|
481
|
// StringBuilder stringBuilder = new StringBuilder();
|
|
|
482
|
// for (byte b : arrayOfByte) {
|
|
|
483
|
// //格式化为:两位十六进制加冒号的格式,若是不足两位,补0
|
|
|
484
|
// stringBuilder.append(String.format("%02X:", new Object[]{Byte.valueOf(b)}));
|
|
|
485
|
// }
|
|
|
486
|
// if (stringBuilder.length() > 0) {
|
|
|
487
|
// //删除后面多余的冒号
|
|
|
488
|
// stringBuilder.deleteCharAt(stringBuilder.length() - 1);
|
|
|
489
|
// }
|
|
|
490
|
// String str = stringBuilder.toString();
|
|
|
491
|
// // wlan0:无线网卡 eth0:以太网卡
|
|
|
492
|
// if (networkInterface.getName().equals("wlan0")) {
|
|
|
493
|
// return str;
|
|
|
494
|
// }
|
|
|
495
|
// }
|
|
|
496
|
// } catch (SocketException socketException) {
|
|
|
497
|
// return null;
|
|
|
498
|
// }
|
|
|
499
|
// return null;
|
|
|
500
|
// }
|
|
|
501
|
//
|
|
502
|
502
|
|
|
503
|
503
|
public static PictureParameterStyle getWhiteStyle(Context context) {
|
|
504
|
504
|
// 相册主题
|