Android ストック ROM と SenseUI などの他の ROM を区別する必要があるアプリを作成しています。
アプリケーション内でそれを行うにはどうすればよいですか?
ありがとう。
Android ストック ROM と SenseUI などの他の ROM を区別する必要があるアプリを作成しています。
アプリケーション内でそれを行うにはどうすればよいですか?
ありがとう。
ro.product.brand
を使用してクエリを実行getprop
すると、必要なものが正確に得られることがわかりました。
/**
* 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などのみを返します...
それが他の誰かにも役立ったことを願っています。