连接手机,adb shell 进入 Android Shell 模式,输入 getprop 获取系统属性值
通过上面方法拿到属性名,然后通过下面方法获取到系统的属性值
/**
* 获取build.prop文件中的某个属性
*
* @param propName 属性名称
* @return 属性值
*/
public static String getSystemProperty(String propName) {
Log.i(LOG_TAG, "getSystemProperty in time: " + System.currentTimeMillis());
String line;
BufferedReader input = null;
try {
Process p = Runtime.getRuntime().exec("getprop " + propName);
input = new BufferedReader(
new InputStreamReader(p.getInputStream()), 1024);
line = input.readLine();
input.close();
} catch (Exception ex) {
Log.e(LOG_TAG, "Unable to read sysprop " + propName, ex);
return null;
} finally {
if (input != null) {
try {
input.close();
} catch (Exception e) {
Log.e(LOG_TAG, "Exception while closing InputStream", e);
}
}
}
Log.i(LOG_TAG, "getSystemProperty out time: " + System.currentTimeMillis());
return line;
}
原文:http://www.cnblogs.com/agilezhu/p/7694133.html