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
How Does Java Store Strings and How Does Substring Work Internally
Why Are the Level.Fine Logging Messages Not Showing
In Java, What Are the Boolean "Order of Operations"
Jaxb Marshalling Unmarshalling with Cdata
Using Locales with Java's Tolowercase() and Touppercase()
Painted Content Invisible While Resizing in Java
Checking for Null - What Order
Get a Node's Inner Xml as String in Java Dom
How to Specify the Root Context in Your <Web-App> Tags in Web.Xml
Java Read Large Text File with 70Million Line of Text
Meaning of New Class(...){{...}} Initialization Idiom
What Is the "Default" Implementation of Method Defined in an Interface
Use of Java [Interfaces/Abstract Classes]
Mocking Files in Java - Mock Contents - Mockito
Last Row Always Removed from Defaulttablemodel, Regardless of Index