【发布时间】:2013-12-25 12:24:43
【问题描述】:
我正在编写一个需要区分 Android Stock ROM 和其他 ROM(如 SenseUI 等)的应用。
如何在我的应用程序中做到这一点?
谢谢。
【问题讨论】:
标签: android samsung-mobile htcsense
我正在编写一个需要区分 Android Stock ROM 和其他 ROM(如 SenseUI 等)的应用。
如何在我的应用程序中做到这一点?
谢谢。
【问题讨论】:
标签: android samsung-mobile htcsense
我发现使用getprop 查询ro.product.brand 会产生我所需要的结果。
/**
* Returns the ROM manufacturer.
*
* @return The ROM manufacturer, or NULL if not found.
*/
public static String getROMManufacturer() {
String line;
BufferedReader input = null;
try {
Process p = Runtime.getRuntime().exec("getprop ro.product.brand");
input = new BufferedReader(new InputStreamReader(p.getInputStream()), 1024);
line = input.readLine();
input.close();
}
catch (IOException ex) {
Log.e(TAG, "Unable to read sysprop ro.product.brand", ex);
return null;
}
finally {
if (input != null) {
try {
input.close();
}
catch (IOException e) {
Log.e(TAG, "Exception while closing InputStream", e);
}
}
}
return line;
}
对于库存 ROM,我们返回的值是 google
以 SenseUI 为例,我们将返回 HTC
上述方法将返回唯一的google或HTC等...
我希望它也对其他人有所帮助。
【讨论】: