美文网首页
[Android] CodeSnippet

[Android] CodeSnippet

作者: PPPaix | 来源:发表于2019-11-22 13:47 被阅读0次

获取系统属性

public static String getSystemProperties(String key,String defaultValue) {
  try {
    final Class<?> systemProperties = Class.forName("android.os.SystemProperties");
    final Method get = systemProperties.getMethod("get", String.class, String.class);
    String result = (String) get.invoke(null, key, defaultValue);
    return TextUtils.isEmpty(result) ? defaultValue : result;
  } catch (Exception e) {
    return defaultValue;
  }
}

运行adb

try
    {
      Runtime.getRuntime().exec(this.cmd + " " + i);
    } catch (IOException e) {
      Log.e("ConfigResetModeClass", "config: " + e.getMessage());
    }

相关文章

网友评论

      本文标题:[Android] CodeSnippet

      本文链接:https://www.haomeiwen.com/subject/ppafwctx.html