Update a few things
This commit is contained in:
@@ -19,8 +19,8 @@ import androidx.compose.ui.res.painterResource
|
||||
import androidx.compose.ui.text.style.TextAlign
|
||||
import androidx.compose.ui.unit.dp
|
||||
import coil.compose.AsyncImage
|
||||
import dev.oxmc.androiddevicenames.DeviceInfo
|
||||
import dev.oxmc.androiddevicenames.AndroidInfo
|
||||
import dev.oxmc.androiddeviceinfo.DeviceInfo
|
||||
import dev.oxmc.androiddeviceinfo.AndroidInfo
|
||||
import dev.oxmc.androiddeviceinfo_demo.ui.theme.AndroidDeviceInfoTheme
|
||||
import kotlinx.coroutines.launch
|
||||
|
||||
@@ -66,12 +66,13 @@ fun DeviceInfoScreen() {
|
||||
androidVersion = "${AndroidInfo.Version.release} (SDK ${AndroidInfo.Version.sdkInt})"
|
||||
|
||||
serial = if (Build.VERSION.SDK_INT < Build.VERSION_CODES.O) {
|
||||
@Suppress("DEPRECATION")
|
||||
Build.SERIAL.takeIf { it != Build.UNKNOWN }
|
||||
?: Settings.Secure.getString(context.contentResolver, Settings.Secure.ANDROID_ID)
|
||||
} else {
|
||||
try {
|
||||
Build.getSerial()
|
||||
} catch (e: SecurityException) {
|
||||
} catch (_: SecurityException) {
|
||||
Settings.Secure.getString(context.contentResolver, Settings.Secure.ANDROID_ID)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user