简体   繁体   中英

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 ). Is there another API in the Android L NDK to access the same property values?

I went with popen as detailed in the answer at https://stackoverflow.com/a/478960/2833126 to run 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);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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