[英]Get android versionCode in ndk
How can i get the android:versionCode from my App which I defined in the Manifest.xml with the NDK within C++ ? 我如何从我在App中定义的android:versionCode与C ++中的NDK一起在Manifest.xml中定义? I need it to check if the versionCode are newer than X and delete old XML files.
我需要它来检查versionCode是否比X更新,并删除旧的XML文件。
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.alexgun.testd"
android:versionCode="3" <------------------------------------
android:versionName="1.0">
best regards Alex. 最好的问候亚历克斯。
#include <cutils/properties.h>
// ...
int myfunction() {
char sdk_ver_str[PROPERTY_VALUE_MAX] = "0";
property_get("ro.build.version.sdk", sdk_ver_str, "0");
sdk_ver = atoi(sdk_ver_str);
// ...
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.