Get Android Device Name

Get Android Device Name

In order to get Android device name you have to add only a single line of code:

android.os.Build.MODEL;

Found here: getting-android-device-name

How to get the device Model Name?

It was really simple, just call:

String model = Build.MODEL;

Update: This code will print the exact string you requested:

String reqString = Build.MANUFACTURER
+ " " + Build.MODEL + " " + Build.VERSION.RELEASE
+ " " + Build.VERSION_CODES.class.getFields()[android.os.Build.VERSION.SDK_INT].getName();

Prints:

Samsung Note 4 6.0 MARSHMALLOW

LGE LG-D410 4.4.2 KITKAT

How can I get the device name in Android?

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);

Link to Android Build Class

How to get Samsung Android Device Name programmatically?

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"/>

Android : Get device name on android tv

this is worked for my AVD (API level 24).

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

Instead of the string "device_name", you can also use the constant Settings.Global.DEVICE_NAME.


This property was moved into Settings.Global in API 17.

Before API 17, the following code should work:

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


Related Topics



Leave a reply



Submit