/
githubmirror
/
omim
Обзор
Документация
Войти
/
githubmirror
/
omim
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
android/jni/com/mapswithme/platform/HttpUserAgent.cpp
17 строк
827 B
Alexander Zatsepin
[android] Implemented getting the app version from native code
10 авг 2018, 20:16
10 авг 2018, 20:16
84ecf86
Код
Авторство
О чём код?
#include "com/mapswithme/core/jni_helper.hpp" #include "platform/http_user_agent.hpp" namespace platform { std::string HttpUserAgent::ExtractAppVersion() const { JNIEnv * env = jni::GetEnv(); static auto const buildConfigClass = jni::GetGlobalClassRef(env, "com/mapswithme/maps/BuildConfig"); auto const versionNameField = jni::GetStaticFieldID(env, buildConfigClass, "VERSION_NAME", "Ljava/lang/String;"); jni::TScopedLocalRef versionNameResult(env, env->GetStaticObjectField(buildConfigClass, versionNameField)); return jni::ToNativeString(env, static_cast<jstring>(versionNameResult.get())); } } // platform