forked from organicmaps/organicmaps
[android] Implemented getting the app version from native code
This commit is contained in:
parent
9a8c58ee09
commit
84ecf864c0
1 changed files with 9 additions and 2 deletions
|
@ -1,10 +1,17 @@
|
|||
#include "com/mapswithme/core/jni_helper.hpp"
|
||||
#include "platform/http_user_agent.hpp"
|
||||
|
||||
namespace platform
|
||||
{
|
||||
std::string HttpUserAgent::ExtractAppVersion() const
|
||||
{
|
||||
//TODO(@alexzatsepin): implement app version extraction.
|
||||
return {};
|
||||
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
|
||||
|
|
Loading…
Add table
Reference in a new issue