Reputation: 5006
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.
Upvotes: 5
Views: 5420
Reputation: 2481
Settings.Global.getString(context.getContentResolver(), "device_name") It working for me.
Upvotes: 0
Reputation: 5085
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/databases/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");
Upvotes: 1
Reputation: 8106
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"/>
Upvotes: 4