KiritoCode
KiritoCode

Reputation: 24

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

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()

Upvotes: 0

Views: 1180

Answers (2)

Mokhtar Abdelhalim
Mokhtar Abdelhalim

Reputation: 237

I think you're looking for this

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

Upvotes: 0

Kishan Mevada
Kishan Mevada

Reputation: 701

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

Upvotes: 2

Related Questions