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);
标签:
android-ndk-r5