Thursday, November 10, 2016
android app read build.prop
String key = "ro.product.name";
String prop = getProp(key);
Log.e(TAG, key + ": [" + prop + "]");
public String getProp(String key) {
Process p = null;
String prop = "";
try {
p = new ProcessBuilder("/system/bin/getprop", key).redirectErrorStream(true).start();
BufferedReader br = new BufferedReader(new InputStreamReader(p.getInputStream()));
String line = "";
while ((line=br.readLine()) != null) {
prop = line;
}
p.destroy();
} catch (IOException e) {
e.printStackTrace();
}
return prop;
}
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment