5

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.

3 Answers3

2

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'

Tom Sengelaub
  • 359
  • 2
  • 5
1
String userDeviceName = Settings.Global.getString(getContentResolver(), Settings.Global.DEVICE_NAME);
if(userDeviceName == null)
    userDeviceName = Settings.Secure.getString(getContentResolver(), "bluetooth_name");

https://stackoverflow.com/a/66651458/4531734

Shpand
  • 661
  • 9
  • 14
-1
Settings.Global.getString(getContentResolver(), "device_name");
F0r3v3r-A-N00b
  • 2,903
  • 4
  • 26
  • 36