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.text.style.TextAlign
|
||||||
import androidx.compose.ui.unit.dp
|
import androidx.compose.ui.unit.dp
|
||||||
import coil.compose.AsyncImage
|
import coil.compose.AsyncImage
|
||||||
import dev.oxmc.androiddevicenames.DeviceInfo
|
import dev.oxmc.androiddeviceinfo.DeviceInfo
|
||||||
import dev.oxmc.androiddevicenames.AndroidInfo
|
import dev.oxmc.androiddeviceinfo.AndroidInfo
|
||||||
import dev.oxmc.androiddeviceinfo_demo.ui.theme.AndroidDeviceInfoTheme
|
import dev.oxmc.androiddeviceinfo_demo.ui.theme.AndroidDeviceInfoTheme
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
|
|
||||||
@@ -66,12 +66,13 @@ fun DeviceInfoScreen() {
|
|||||||
androidVersion = "${AndroidInfo.Version.release} (SDK ${AndroidInfo.Version.sdkInt})"
|
androidVersion = "${AndroidInfo.Version.release} (SDK ${AndroidInfo.Version.sdkInt})"
|
||||||
|
|
||||||
serial = if (Build.VERSION.SDK_INT < Build.VERSION_CODES.O) {
|
serial = if (Build.VERSION.SDK_INT < Build.VERSION_CODES.O) {
|
||||||
|
@Suppress("DEPRECATION")
|
||||||
Build.SERIAL.takeIf { it != Build.UNKNOWN }
|
Build.SERIAL.takeIf { it != Build.UNKNOWN }
|
||||||
?: Settings.Secure.getString(context.contentResolver, Settings.Secure.ANDROID_ID)
|
?: Settings.Secure.getString(context.contentResolver, Settings.Secure.ANDROID_ID)
|
||||||
} else {
|
} else {
|
||||||
try {
|
try {
|
||||||
Build.getSerial()
|
Build.getSerial()
|
||||||
} catch (e: SecurityException) {
|
} catch (_: SecurityException) {
|
||||||
Settings.Secure.getString(context.contentResolver, Settings.Secure.ANDROID_ID)
|
Settings.Secure.getString(context.contentResolver, Settings.Secure.ANDROID_ID)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -15,7 +15,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package dev.oxmc.androiddevicenames
|
package dev.oxmc.androiddeviceinfo
|
||||||
|
|
||||||
object AltDeviceNames {
|
object AltDeviceNames {
|
||||||
/**
|
/**
|
@@ -1,4 +1,4 @@
|
|||||||
package dev.oxmc.androiddevicenames
|
package dev.oxmc.androiddeviceinfo
|
||||||
|
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.os.Build
|
import android.os.Build
|
@@ -15,7 +15,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package dev.oxmc.androiddevicenames
|
package dev.oxmc.androiddeviceinfo
|
||||||
|
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.database.SQLException
|
import android.database.SQLException
|
@@ -15,7 +15,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package dev.oxmc.androiddevicenames
|
package dev.oxmc.androiddeviceinfo
|
||||||
|
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.os.Build
|
import android.os.Build
|
@@ -15,7 +15,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package dev.oxmc.androiddevicenames
|
package dev.oxmc.androiddeviceinfo
|
||||||
|
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.os.Build
|
import android.os.Build
|
||||||
@@ -75,8 +75,6 @@ object AndroidDeviceInfo {
|
|||||||
model
|
model
|
||||||
}
|
}
|
||||||
|
|
||||||
//Log.i("DeviceInfo", "Device name: $finalDeviceName, codename: $codename, model: $model, manufacturer: $manufacturer")
|
|
||||||
|
|
||||||
return DeviceInfo(manufacturer, finalDeviceName, codename, model)
|
return DeviceInfo(manufacturer, finalDeviceName, codename, model)
|
||||||
}
|
}
|
||||||
|
|
Reference in New Issue
Block a user