Replacement for `__system_property_get` in Android L NDK

狂风中的少年 提交于 2019-12-06 02:40:33

问题


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?


回答1:


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


来源:https://stackoverflow.com/questions/26722040/replacement-for-system-property-get-in-android-l-ndk

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!