5

Other similar questions in SO are answered by retrieving the Build.MODEL name.

But what I would really like is to get the customizable Device name on Samsung Devices. I know it is customizable because on my Galaxy Note, I can change it from the settings->About device. For example, below, I would like to retrieve the "Milky Way" string.

enter image description here

3 Answers 3

4

There is no common way getting this, since it's not a "android-feature" more likely a Samsung Feature afaik.

Try getting it with this, which worked on my galaxy s3, s4 and s5

BluetoothAdapter myDevice = BluetoothAdapter.getDefaultAdapter(); String deviceName = myDevice.getName(); 

Do not forget to add the bluetooth permissions.

<uses-permission android:name="android.permission.BLUETOOTH"/> 
Sign up to request clarification or add additional context in comments.

1 Comment

Thanks @Emanuel S this code snippet helps a lot. But found a limitation with the code. When Bluetooth is OFF and changed the name of the phone, the code didn't provide newly changed phone name until Bluetooth is turned ON again. Please help in handling this scenario.
1

I tried

BluetoothAdapter myDevice = BluetoothAdapter.getDefaultAdapter(); String deviceName = myDevice.getName(); 

still returns the SM-G900H.

After some research I found the device_name in /data/data/com.android.providers.settings/da‌​tabases/settings‌​.db

I manage to get it using following shell command

settings get system device_name 

Code:

String deviceName = Settings.System.getString(getContentResolver(), "device_name"); 

3 Comments

its return null on samsung device
look at the device_name in /data/data/com.android.providers.settings/da‌​tabases/settings‌​.db
It worked for me for both yours and his solution above bro. maybe use missed runtime permission.
0

Settings.Global.getString(context.getContentResolver(), "device_name") It working for me.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.