简体   繁体   English

在Android L NDK中替换`__system_property_get`

[英]Replacement for `__system_property_get` in Android L NDK

As of the Android L NDK, __system_property_get is removed ( https://groups.google.com/a/chromium.org/forum/#!topic/chromium-reviews/keQP6L9aVyU ). 自Android L NDK起,删除了__system_property_gethttps://groups.google.com/a/chromium.org/forum/#!topic/chromium-reviews/keQP6L9aVyU )。 Is there another API in the Android L NDK to access the same property values? Android L NDK中是否有另一个API可以访问相同的属性值?

I went with popen as detailed in the answer at https://stackoverflow.com/a/478960/2833126 to run getprop . 我在https://stackoverflow.com/a/478960/2833126的答案中详细介绍了popen以运行getprop Something like 就像是

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);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM