From Android 4.2 onwards, user can change the Device name in settings menu. Is there any API exposed to retrieve that value from code??

From Android 4.2 onwards, user can change the Device name in settings menu. Is there any API exposed to retrieve that value from code??

Yes you can, use this:
android.os.Build.MODEL
to get the model,and this to get the manufacturer:
android.os.Build.MANUFACTURER
UPDATE: As been said here, No all device will have this option. You can try getting it this way:
BluetoothAdapter myDevice = BluetoothAdapter.getDefaultAdapter();
String deviceName = myDevice.getName();
add a perrmision to the manifest file as well:
<uses-permission android:name="android.permission.BLUETOOTH"/>
reference: How do you get the user defined "Device Name" in android?
But this wont always work.
To display the device name/model in android use:
TextView tv1 = (TextView) findViewById(R.id.tv1);
String str = android.os.Build.MODEL;
tv1.setText(str);
I dont think you can rely on this functionality as it may be a Samsung modification.
My Nexus 5 does not have the ability to change the device name on this settings page on Android 4.4