How to get the device model name ? I have a Yuphoria 5010 which displays YU5010 in device Model Number, I want to fetch the full name of the device? I want the fetch the exact string given below:
Yuphoria 5010 6.0 Marshmallow
How to get the device model name ? I have a Yuphoria 5010 which displays YU5010 in device Model Number, I want to fetch the full name of the device? I want the fetch the exact string given below:
Yuphoria 5010 6.0 Marshmallow
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
On many popular devices the market name of the device is not available. For example, on the Samsung Galaxy S6 the value of Build.MODEL could be "SM-G920F", "SM-G920I", or "SM-G920W8". So for getting full device name you can use a library which is available on github . Link of AndroidDeviceLibrary is here https://github.com/shubhamsharmacs/AndroidDeviceNames
Now how to use these library :- put these in your build.gradle file
compile 'com.jaredrummler:android-device-names:1.0.9'
Now these operations are :
Get the name of the current device:
String deviceName = DeviceName.getDeviceName();
The above code will get the correct device name for the top 600 Android devices. If the device is unrecognized, then Build.MODEL is returned. This can be executed from the UI thread.
Get the name of a device using the device's codename:
// Retruns "Moto X Style"
DeviceName.getDeviceName("clark", "Unknown device");
Get information about the device:
DeviceName.with(context).request(new DeviceName.Callback() {
@Override public void onFinished(DeviceName.DeviceInfo info, Exception error) {
String manufacturer = info.manufacturer; // "Samsung"
String name = info.marketName; // "Galaxy S7 Edge"
String model = info.model; // "SAMSUNG-SM-G935A"
String codename = info.codename; // "hero2lte"
String deviceName = info.getName(); // "Galaxy S7 Edge"
// FYI: We are on the UI thread.
}
});
The above code loads JSON from a generated list of device names based on Google's maintained list. It will be up-to-date with Google's supported device list so that you will get the correct name for new or unknown devices. This supports over 10,000 devices.
This will only make a network call once. The value is saved to SharedPreferences for future calls.
You can get the device details by using the below code.
String s="Debug-infos:\n";
s += "OS Version: " + System.getProperty("os.version") + "(" + android.os.Build.VERSION.INCREMENTAL + ")\n";
s += "OS API Level: " + android.os.Build.VERSION.RELEASE + "(" + android.os.Build.VERSION.SDK_INT + ")\n";
s += "Device: " + android.os.Build.DEVICE + "\n";
s += "Model (and Product): " + android.os.Build.MODEL + " ("+ android.os.Build.PRODUCT + ")\n";
USe this code for get device Model
import android.os.Build;
String deviceModel = Build.MODEL;
if you want get this info in android 6.0 Marshmellow so before this get info give the run time permission
Manifest.permission.READ_PHONE_STATE