How to get the build.prop values?

后端 未结 8 940
梦谈多话
梦谈多话 2021-01-06 07:03

How do I get the build.prop values that are found in /system/build.prop without root access? How do I edit them?

8条回答
  •  天命终不由人
    2021-01-06 07:39

    You can probably consider using SystemProperties.get("someKey") as suggested by @kangear in your application using reflection like:

    public String getSystemProperty(String key) {
        String value = null;
    
        try {
            value = (String) Class.forName("android.os.SystemProperties")
                    .getMethod("get", String.class).invoke(null, key);
        } catch (Exception e) {
          e.printStackTrace();
        }
    
        return value;
    }
    

    And then you can use it any where like:

    getSystemProperty("someKey");
    

提交回复
热议问题