提交 2e8fd522 编写于 作者: B Blankj

see 06/01 log

上级 3a2726df
......@@ -41,7 +41,7 @@
[logo]: https://raw.githubusercontent.com/Blankj/AndroidUtilCode/master/art/logo.png
[aucsvg]: https://img.shields.io/badge/AndroidUtilCode-v1.16.3-brightgreen.svg
[aucsvg]: https://img.shields.io/badge/AndroidUtilCode-v1.16.4-brightgreen.svg
[auc]: https://github.com/Blankj/AndroidUtilCode
[apisvg]: https://img.shields.io/badge/API-14+-brightgreen.svg
......
......@@ -41,7 +41,7 @@ If this project helps you a lot and you want to support the project's developmen
[logo]: https://raw.githubusercontent.com/Blankj/AndroidUtilCode/master/art/logo.png
[aucsvg]: https://img.shields.io/badge/AndroidUtilCode-v1.16.3-brightgreen.svg
[aucsvg]: https://img.shields.io/badge/AndroidUtilCode-v1.16.4-brightgreen.svg
[auc]: https://github.com/Blankj/AndroidUtilCode
[apisvg]: https://img.shields.io/badge/API-14+-brightgreen.svg
......
......@@ -57,5 +57,5 @@ dependencies {
implementation 'com.android.support.constraint:constraint-layout:1.1.0'
debugImplementation "com.squareup.leakcanary:leakcanary-android:$leakcanary_version"
releaseImplementation "com.squareup.leakcanary:leakcanary-android-no-op:$leakcanary_version"
// implementation 'com.blankj:utilcode:1.16.3'
// implementation 'com.blankj:utilcode:1.16.4'
}
......@@ -44,8 +44,8 @@ ext {
min_sdk_version = 14
target_sdk_version = 27
version_code = 1_016_003
version_name = '1.16.3'// E.g 1.9.72 => 1,009,072
version_code = 1_016_004
version_name = '1.16.4'// E.g 1.9.72 => 1,009,072
// App dependencies
support_version = '27.1.0'
......
* 18/05/30 完善 DeviceUtils#getMacAddress,发布 1.16.4 版本
* 18/05/30 修复 ToastUtils 在 targetSdkVersion 为 27 在 api 25 机器快速 show 两次崩溃的异常,发布 1.16.3 版本
* 18/05/29 完善 TimeUtils 的 timeSpan 带符号位,ToastUtils 去除弱引用,发布 1.16.2 版本
* 18/05/25 新增 AppUtils#registerAppStatusChangedListener 和 AppUtils#unregisterAppStatusChangedListener,发布 1.16.1 版本
......
......@@ -2,7 +2,7 @@
Gradle:
```groovy
implementation 'com.blankj:utilcode:1.16.3'
implementation 'com.blankj:utilcode:1.16.4'
```
......
......@@ -2,7 +2,7 @@
Gradle:
```groovy
implementation 'com.blankj:utilcode:1.16.3'
implementation 'com.blankj:utilcode:1.16.4'
```
......
......@@ -93,23 +93,48 @@ public final class DeviceUtils {
*/
@RequiresPermission(allOf = {ACCESS_WIFI_STATE, INTERNET})
public static String getMacAddress() {
return getMacAddress((String[]) null);
}
/**
* Return the MAC address.
* <p>Must hold
* {@code <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />},
* {@code <uses-permission android:name="android.permission.INTERNET" />}</p>
*
* @return the MAC address
*/
@RequiresPermission(allOf = {ACCESS_WIFI_STATE, INTERNET})
public static String getMacAddress(final String... excepts) {
String macAddress = getMacAddressByWifiInfo();
if (!"02:00:00:00:00:00".equals(macAddress)) {
if (isAddressNotInExcepts(macAddress, excepts)) {
return macAddress;
}
macAddress = getMacAddressByNetworkInterface();
if (!"02:00:00:00:00:00".equals(macAddress)) {
if (isAddressNotInExcepts(macAddress, excepts)) {
return macAddress;
}
macAddress = getMacAddressByInetAddress();
if (!"02:00:00:00:00:00".equals(macAddress)) {
if (isAddressNotInExcepts(macAddress, excepts)) {
return macAddress;
}
macAddress = getMacAddressByFile();
if (!"02:00:00:00:00:00".equals(macAddress)) {
if (isAddressNotInExcepts(macAddress, excepts)) {
return macAddress;
}
return "please open wifi";
return "";
}
private static boolean isAddressNotInExcepts(final String address, final String... excepts) {
if (excepts == null || excepts.length == 0) {
return !"02:00:00:00:00:00".equals(address);
}
for (String filter : excepts) {
if (address.equals(filter)) {
return false;
}
}
return true;
}
@SuppressLint({"HardwareIds", "MissingPermission"})
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册