Hello. In connection with the previous question, this one arose - how to determine the name of the phone model from an application in order to perform specific actions with it for a specific model.

The only thing I’ve dug myself is System.getProperties (); Returns a list of system properties. There is a St.-in http.agent, where in the long description line is the name of the phone model.

For example, for Samsung Galaxy Ace, it looks like this: Dalvik / 1.4.0 (Linux; U; Android 2.3.5; GT-S5830 Build / GINGERBREAD) Where the GT-S5830 itself is the phone model.

For HTC Desire, by analogy, the line is straightforward and the HTC Desire is written in it :)

Unfortunately, I could only check on 2 devices that it is true, and the name is present there. As will be on others - hz Therefore, I address the question: can one unambiguously unlock the phone model of this property, or is there another, more reliable method?

    1 answer 1

    public String getDeviceName() { String manufacturer = Build.MANUFACTURER; String model = Build.MODEL; if (model.startsWith(manufacturer)) { return capitalize(model); } else { return capitalize(manufacturer) + " " + model; } } private String capitalize(String s) { if (s == null || s.length() == 0) { return ""; } char first = s.charAt(0); if (Character.isUpperCase(first)) { return s; } else { return Character.toUpperCase(first) + s.substring(1); } } 

    A couple of examples of what will happen:

    Samsung GT-S5830L

    Motorola MB860

    Sony Ericsson LT18i

    LGE LG-P500

    HTC Desire V

    HTC Wildfire S A510e

    ...

    • one
      yeah thank. Just the same Google gave out :) I'm already trying. - Demon051