Thursday, November 22, 2018

How to get Custom SW version number of android



I have a Marshmallow device. It has custom built SW.
enter image description here



I have seen the build.prop file. There I can perceive the Software version name comes from ro.custom.build.version



enter image description here




My question is - how can I get the "ro.custom.build.version" information programmatically in my application ?


Answer



I got the answer. It is very simple -
First, I created a function to read from SystemProperties.



public String getSystemProperty(String key) {
String value = null;

try {

value = (String) Class.forName("android.os.SystemProperties")
.getMethod("get", String.class).invoke(null, key);
} catch (Exception e) {
e.printStackTrace();
}

return value;
}



And then called the function with "ro.custom.build.version" as a key



getSystemProperty("ro.custom.build.version");


Special thanks to @sasikumar for giving me the hint


No comments:

Post a Comment

plot explanation - Why did Peaches' mom hang on the tree? - Movies & TV

In the middle of the movie Ice Age: Continental Drift Peaches' mom asked Peaches to go to sleep. Then, she hung on the tree. This parti...