How to get an Android Device Nickname

A Comparison of the Top 5 Methods on Popular Android Devices

Jason Pribble
Capital One Tech
2 min readMay 8, 2019

--

Background

On most Android devices, users have the option to set a custom device nickname to make it easier for them to identity their device. When showing a user a list of their devices, we want their custom device name to be displayed instead of the factory default value if it’s available.

Research

I searched the web and found several different methods to read the user specified device nickname on Android:

  1. Settings.System.getString(getContentResolver(), “bluetooth_name”);
  2. Settings.Secure.getString(getContentResolver(), “bluetooth_name”);
  3. BluetoothAdapter.getDefaultAdapter().getName();
  4. Settings.System.getString(getContentResolver(), “device_name”);
  5. Settings.Secure.getString(getContentResolver(), “lock_screen_owner_info”);

Note: #3 requires Bluetooth permission.

Sources:

Results

But how do they perform on various popular Android devices? The # columns in the table below refer to the methods used to access the device nickname referenced in the ‘Research’ section above. A green check indicates that we were able to successfully read the user’s custom device nickname.

Conclusion

There is no standardized Android API to read the user specified device nickname and not all Android devices support a custom nickname. There are ways to read this data but none work on all Android devices.

Although we didn’t find a consistent way to access the user specified device nickname, there are libraries available like AndroidDeviceNames that can provide a more readable device name than the factory set value (e.g. “sailfish”). For example, it can provide “Samsung S8+” which a user is more likely to recognize than the codename “dream2qltecan” or model number “SM-G955W”.

DISCLOSURE STATEMENT: These opinions are those of the author. Unless noted otherwise in this post, Capital One is not affiliated with, nor is it endorsed by, any of the companies mentioned. All trademarks and other intellectual property used or displayed are the ownership of their respective owners. This article is © 2019 Capital One.

--

--