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.