The getSerial function is not executed by the system application and an error is reported

This commit is contained in:
Jtun-coder 2024-11-28 09:24:18 +08:00
parent 9b1d2e1e25
commit c5163fe939
3 changed files with 8 additions and 5 deletions

View File

@ -11,9 +11,9 @@
"type": "SINGLE",
"filters": [],
"attributes": [],
"versionCode": 2,
"versionName": "1.0.02",
"outputFile": "JtunRouter_v1.0.02.apk"
"versionCode": 3,
"versionName": "1.0.03",
"outputFile": "JtunRouter_v1.0.03.apk"
}
],
"elementType": "File"

View File

@ -1,7 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:sharedUserId="android.uid.system"
>
<uses-feature

View File

@ -62,7 +62,11 @@ object DeviceUtil {
fun getDeviceSerial():String{
var serial = ""
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
serial = Build.getSerial()
try {
//不是系统应用会报错
serial = Build.getSerial()
}catch (_:Exception){
}
if(serial.isEmpty()){
WifiApControl.getInstance().getImei()?.let {
serial = it