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)
|
||||
}
|
||||
}
|
||||
|
@@ -15,7 +15,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package dev.oxmc.androiddevicenames
|
||||
package dev.oxmc.androiddeviceinfo
|
||||
|
||||
object AltDeviceNames {
|
||||
/**
|
@@ -1,4 +1,4 @@
|
||||
package dev.oxmc.androiddevicenames
|
||||
package dev.oxmc.androiddeviceinfo
|
||||
|
||||
import android.content.Context
|
||||
import android.os.Build
|
@@ -15,7 +15,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package dev.oxmc.androiddevicenames
|
||||
package dev.oxmc.androiddeviceinfo
|
||||
|
||||
import android.content.Context
|
||||
import android.database.SQLException
|
@@ -15,7 +15,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package dev.oxmc.androiddevicenames
|
||||
package dev.oxmc.androiddeviceinfo
|
||||
|
||||
import android.content.Context
|
||||
import android.os.Build
|
@@ -15,7 +15,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package dev.oxmc.androiddevicenames
|
||||
package dev.oxmc.androiddeviceinfo
|
||||
|
||||
import android.content.Context
|
||||
import android.os.Build
|
||||
@@ -75,8 +75,6 @@ object AndroidDeviceInfo {
|
||||
model
|
||||
}
|
||||
|
||||
//Log.i("DeviceInfo", "Device name: $finalDeviceName, codename: $codename, model: $model, manufacturer: $manufacturer")
|
||||
|
||||
return DeviceInfo(manufacturer, finalDeviceName, codename, model)
|
||||
}
|
||||
|
Reference in New Issue
Block a user