I have a weird issue with reading a property on Android R. While it works when I use the Runtime() exec call, it fails with a simple getProperty() method. Any ideas what could be wrong?
Runtime.getRuntime().exec("getprop my_prop")
vs
System.getProperty("my_prop", "defaultValue")
Command getprop
refers to the system properties that are built with the OS and can be accessed via SystemProperties.get("my_prop", "defaultValue")
function. but SystemProperties
is a firmware level class and not accessible for apps. Using Runtime.getRuntime().exec("getprop")
does not always work because some properties are defined in restricted files depending on manufacturer.
But System.getProperty("my_prop")
is for system runtime properties like http proxy.
I hope this is clear enough.