3

On my Moto Maxx & Moto Razr HD (probably all Moto devices), there is an entry in the About Phone settings that states System version. I am writing an app that pulls this info from the phone but I cannot find where Motorola is pulling that info from. All the Build.VERSION, Build.DISPLAY, etc do not contain it. I have even read in the "/proc/version" from the Linux system, which doesn't contain it as well. Thoughts?Moto About Phone

UPDATE: With everyone's help it pushed me in the right direction. My solution was:

private String getDeviceBuildVersion() {
    //Get Moto Info
        String line = "Note sure...";
        try {
            Process ifc = Runtime.getRuntime().exec("getprop " + "ro.build.version.full");
            BufferedReader bis = new BufferedReader(new InputStreamReader(ifc.getInputStream()));
            line = bis.readLine();
            ifc.destroy();
        } catch (java.io.IOException e) {
            e.printStackTrace();
        }
    return line;
}
opt05
  • 813
  • 11
  • 21

2 Answers2

2

It's most likely stored as an Android system property.

Assuming you're connected to the phone through adb, run this command:

adb shell getprop

This will list all of the system properties set in the system. Look for that system version string and you'll see which property it's stored as. Then when you know the name of the property it's stored as, you can use System.getProperty() to grab it programmatically.

If it's not there, Motorola is probably hiding the string somewhere in their modified source and unfortunately you won't be able to get to it.

vdelricco
  • 749
  • 4
  • 15
  • This pushed me the right direction, as it was listed in the getprop as 'ro.build.version.full' though System.getProperty() wouldn't return it... – opt05 Feb 18 '15 at 20:46
  • Hmm, may somehow be a protected property. The only other option I see is to use the hidden android.os.SystemProperties class. This may be a pain though as you would have to use reflection. You can read more about that here: http://stackoverflow.com/questions/2641111/where-is-android-os-systemproperties. SystemProperties has a method get() that may return the value you want. I'm still unsure as to why it wouldn't work System.getProperty(). – vdelricco Feb 18 '15 at 20:50
  • [This](https://github.com/thuxnder/android-getprop/blob/master/src/main/java/name/unused/android/utils/systemproperties/SystemProperty.java) may also come in handy if you choose to go down the road of reflection. – vdelricco Feb 18 '15 at 20:55
  • The SystemProperties.get() worked, thanks! Though do you see an issue of that method vs the Runtime.getRuntime().exec("getprop " I posted a little bit ago above? – opt05 Feb 18 '15 at 21:09
  • Either way should work, really. I tend to prefer the SystemProperties way because we don't need to execute an outside process, but it's really up to you. Glad it worked for you! – vdelricco Feb 18 '15 at 21:15
1

Have a look at android.os.Build.VERSION.

CODENAME : The current development codename, or the string "REL" if this is a release build.
INCREMENTAL : The internal value used by the underlying source control to represent this build.
RELEASE : The user-visible version string.

CodeWalker
  • 2,281
  • 4
  • 23
  • 50