Skip to content

Commit 7de5a40

Browse files
author
Wonday
committed
fix MIUI check method
1 parent e7cfcb0 commit 7de5a40

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

android/src/main/java/org/wonday/aliyun/push/MIUIUtils.java

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -48,18 +48,25 @@ public class MIUIUtils {
4848

4949

5050
public static boolean isMIUI(Context context) {
51-
if(hasChecked)
52-
{
51+
if(hasChecked) {
5352
return isMIUI;
5453
}
54+
5555
try {
5656
SystemProperty sp = new SystemProperty(context);
57-
if (sp.getOrThrow(KEY_MIUI_VERSION_CODE) != null || sp.getOrThrow(KEY_MIUI_VERSION_NAME) != null || sp.getOrThrow(KEY_MIUI_INTERNAL_STORAGE) != null) {
57+
String ret1 = "";
58+
String ret2 = "";
59+
String ret3 = "";
60+
ret1 = sp.getOrThrow(KEY_MIUI_VERSION_CODE);
61+
ret2 = sp.getOrThrow(KEY_MIUI_VERSION_NAME);
62+
ret3 = sp.getOrThrow(KEY_MIUI_INTERNAL_STORAGE);
63+
if ((ret1 != null && ret1.compareToIgnoreCase("") != 0) ||
64+
(ret2 != null && ret2.compareToIgnoreCase("") != 0) ||
65+
(ret3 != null && ret3.compareToIgnoreCase("") != 0)) {
5866
hasChecked = true;
5967
isMIUI = true;
6068
}
61-
} catch (Exception e)
62-
{
69+
} catch (Exception e) {
6370
e.printStackTrace();
6471
return false;
6572
}

0 commit comments

Comments
 (0)