From 2db8134d20c35e950067797d8ecf45b6d71a37a9 Mon Sep 17 00:00:00 2001 From: Leith Bade Date: Wed, 10 Dec 2014 19:14:05 +1100 Subject: [PATCH] Add Android user-agent info --- android/cpp/jni.cpp | 7 +++++++ gyp/mbgl-android.gypi | 3 +++ include/mbgl/android/jni.hpp | 1 + 3 files changed, 11 insertions(+) diff --git a/android/cpp/jni.cpp b/android/cpp/jni.cpp index 0f42e2cf5..fd92ba8f4 100644 --- a/android/cpp/jni.cpp +++ b/android/cpp/jni.cpp @@ -10,6 +10,7 @@ #include #include +#include #include @@ -38,6 +39,7 @@ namespace android { std::string cachePath; std::string dataPath; std::string apkPath; +std::string androidRelease; jmethodID onMapChangedId = nullptr; jmethodID onFpsChangedId = nullptr; @@ -933,6 +935,11 @@ extern "C" JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM *vm, void *reserved) { return JNI_ERR; } + + char release[PROP_VALUE_MAX] = ""; + __system_property_get("ro.build.version.release", release); + androidRelease = std::string(release); + return JNI_VERSION_1_6; } diff --git a/gyp/mbgl-android.gypi b/gyp/mbgl-android.gypi index a22eaace1..0725ea3e4 100644 --- a/gyp/mbgl-android.gypi +++ b/gyp/mbgl-android.gypi @@ -5,6 +5,9 @@ 'type': 'static_library', 'standalone_static_library': 1, 'hard_dependency': 1, + 'dependencies': [ + 'version', + ], 'variables': { 'cflags_cc': [ '<@(png_cflags)', diff --git a/include/mbgl/android/jni.hpp b/include/mbgl/android/jni.hpp index 31772cf59..883f691cb 100644 --- a/include/mbgl/android/jni.hpp +++ b/include/mbgl/android/jni.hpp @@ -10,6 +10,7 @@ namespace android { extern std::string cachePath; extern std::string dataPath; extern std::string apkPath; +extern std::string androidRelease; extern jmethodID onMapChangedId; extern jmethodID onFpsChangedId;