Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Get Android user defined device name by code

Tags:

android

device

I want to get my android phone device/phone name that defined by user. I already know android.os.Build.MODEL which return exact model of my device, But I want to get the name that sate by user or owner of the phone.

like image 326
masoud farahani Avatar asked Nov 13 '22 05:11

masoud farahani


1 Answers

The problem is that not all Android devices have such a custom name, therefor there is no direct way of getting it reliable.

What I have experienced (at least for Samsung) is that the user-defined name is also used for the WifiP2pDevice name: http://developer.android.com/reference/android/net/wifi/p2p/WifiP2pDevice.html

Some manufacturers also use it as the default Bluetooth-Name or as the Hostname, anyway you can check what property is used for your phone by using dumpsys in an adb shell

dumpsys | grep 'My new phone'

like image 101
Tom Sengelaub Avatar answered Nov 16 '22 02:11

Tom Sengelaub