update:2020.05.23
fix:10.0网络问题,设备号获取问题 add:
This commit is contained in:
@@ -48,6 +48,7 @@ import java.io.FileReader;
|
||||
import java.io.InputStreamReader;
|
||||
import java.io.LineNumberReader;
|
||||
import java.io.Reader;
|
||||
import java.lang.reflect.Method;
|
||||
import java.net.NetworkInterface;
|
||||
import java.security.MessageDigest;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
@@ -408,14 +409,14 @@ public class Utils {
|
||||
public static void unInstallAPP(Context context, String packageName) {
|
||||
if (!TextUtils.isEmpty(packageName) && !AppsManagerUtils.isSystemApp(context, packageName)) {
|
||||
if (AppsManagerUtils.isSystemApp(context, packageName)) {
|
||||
Toast.makeText(MyApplication.getAppContext(), "系统应用无法卸载!", Toast.LENGTH_SHORT).show();
|
||||
ToastUtil.show("系统应用无法卸载!");
|
||||
} else {
|
||||
Uri packageURI = Uri.parse("package:" + packageName);
|
||||
Intent intent = new Intent(Intent.ACTION_DELETE, packageURI);
|
||||
context.startActivity(intent);
|
||||
}
|
||||
} else {
|
||||
Toast.makeText(MyApplication.getAppContext(), "系统应用无法卸载!", Toast.LENGTH_SHORT).show();
|
||||
ToastUtil.show("系统应用无法卸载!");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -688,11 +689,24 @@ public class Utils {
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@SuppressLint({"MissingPermission", "NewApi"})
|
||||
public static String getSerial() {
|
||||
return Build.SERIAL;
|
||||
// return "QNS3AI000111";
|
||||
// return "QNW8WJ900002";
|
||||
|
||||
String serial = "unknow";
|
||||
try {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {//9.0+
|
||||
serial = Build.getSerial();
|
||||
} else if (Build.VERSION.SDK_INT > Build.VERSION_CODES.N) {//8.0+
|
||||
serial = Build.SERIAL;
|
||||
} else {//8.0-
|
||||
Class<?> c = Class.forName("android.os.SystemProperties");
|
||||
Method get = c.getMethod("get", String.class);
|
||||
serial = (String) get.invoke(c, "ro.serialno");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
Log.e("e", "读取设备序列号异常:" + e.toString());
|
||||
}
|
||||
return serial;
|
||||
}
|
||||
|
||||
public static final long A_GB = 1073741824;
|
||||
@@ -860,5 +874,4 @@ public class Utils {
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user