Get Android user defined username by code

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

+4
source share
1 answer

The problem is that not all Android devices have such a custom name, so there is no direct way to get it reliable.

What I experienced (at least for Samsung) is that the user-defined username 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 host name, in any case, you can check which property is used for your phone using dumpsys in the adb shell

dumpsys | grep 'My new phone'

+1
source

Source: https://habr.com/ru/post/1413891/


All Articles