【问题标题】:Replacement for `__system_property_get` in Android L NDK在 Android L NDK 中替换 `__system_property_get`
【发布时间】:2014-12-30 13:40:12
【问题描述】:

从 Android L NDK 开始,__system_property_get 已被删除 (https://groups.google.com/a/chromium.org/forum/#!topic/chromium-reviews/keQP6L9aVyU)。 Android L NDK 中是否有其他 API 可以访问相同的属性值?

【问题讨论】:

    标签: android-ndk-r5


    【解决方案1】:

    我与popen 一起去https://stackoverflow.com/a/478960/2833126 的答案中详细说明了运行getprop。类似的东西

    std::string command = "getprop ro.product.model";
    FILE* file = popen(command.c_str(), "r");
    if (!file) {
        // error
    }
    // read the property value from file
    pclose(file);
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-06-04
      • 2018-12-10
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多