How can I detect the device run under Xiomi's MIUI ROM? I'm able to detect Xiomi device with the following code.
String manufacturer = "xiaomi";
if (manufacturer.equalsIgnoreCase(android.os.Build.MANUFACTURER)) {
}
But how can I detect its MIUI?
Get device properties: adb shell getprop should result with:
And a few more consisting MIUI specific properties
Class<?> c = Class.forName("android.os.SystemProperties");
Method get = c.getMethod("get", String.class);
String miui = (String) get.invoke(c, "ro.miui.ui.version.code"); // maybe this one or any other
// if string miui is not empty, bingo
Or, get list of packages: adb shell pm list packages should result with
So you could check with this piece of code:
//installedPackages - list them through package manager
for (String packageName : installedPackages) {
if (packageName.startsWith("com.miui.")) {
return true;
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With