2017-08-21 5 views

Répondre

2

J'ai trouvé un aperçu sur github qui vise à faire exactement cela, en essayant de récupérer la propriété système "ro.miui.ui.version.name".

public static boolean isMiUi() { 
    return !TextUtils.isEmpty(getSystemProperty("ro.miui.ui.version.name")); 
} 

public static String getSystemProperty(String propName) { 
    String line; 
    BufferedReader input = null; 
    try { 
     java.lang.Process p = Runtime.getRuntime().exec("getprop " + propName); 
     input = new BufferedReader(new InputStreamReader(p.getInputStream()), 1024); 
     line = input.readLine(); 
     input.close(); 
    } catch (IOException ex) { 
     return null; 
    } finally { 
     if (input != null) { 
      try { 
       input.close(); 
      } catch (IOException e) { 
       e.printStackTrace(); 
      } 
     } 
    } 
    return line; 
} 

Origin on github