0

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??

enter image description here

Tapas Jena
  • 1,069
  • 4
  • 14
  • 23
  • maybe this helps http://stackoverflow.com/questions/6662216/display-android-bluetooth-device-name – A.S. Dec 19 '13 at 09:50

3 Answers3

1

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.

Community
  • 1
  • 1
Emil Adz
  • 40,709
  • 36
  • 140
  • 187
0

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);
VenuNalla
  • 39
  • 8
0

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

Kuffs
  • 35,581
  • 10
  • 79
  • 92