Why I cant get the Device name even the device have Device name in android?

772 views Asked by At

I made a condition that if the device doesn't have Device name it will get the Device model. But the thing is on some devices I'm getting the Device model even the device have Device name. Do you guys have an idea why I'm getting Device model not device name?

fun getDeviceName(): String =
    Settings.Global.getString(context.contentResolver, "device_name") ?: getDeviceNameIfNull()
2

There are 2 answers

0
Kishan Mevada On

Follow this code snippet, this might help you finding what you are looking for :

val model = Build.MODEL
val id = Build.ID
val manufacturer = Build.MANUFACTURER
val brand = Build.BRAND
val type = Build.TYPE
val user = Build.USER
val base = Build.VERSION_CODES.BASE
val incremental = Build.VERSION.INCREMENTAL
val sdk = Build.VERSION.SDK_INT
val board = Build.BOARD
val host = Build.HOST
0
Mokhtar Abdelhalim On

I think you're looking for this

val deviceModel = Build.MANUFACTURER + " " + Build.MODEL;