diff --git a/.gitignore b/.gitignore
index 4b6ae66fa3..e7286cece5 100644
--- a/.gitignore
+++ b/.gitignore
@@ -92,6 +92,8 @@ data/settings.ini
!data/route_test2.osm.bz2
data/index.idx
data/index.stamp
+# local statistics storage
+data/stats
# benchmark results
data/benchmarks/*.trace
@@ -121,4 +123,4 @@ tizen/*/.*
!tizen/*/.project
tizen/*/crash-info/*
-.idea/*
\ No newline at end of file
+.idea/*
diff --git a/android/AndroidManifest.xml b/android/AndroidManifest.xml
index dc07a35951..c1b7940ea7 100644
--- a/android/AndroidManifest.xml
+++ b/android/AndroidManifest.xml
@@ -304,6 +304,16 @@
+
+
+
+
+
+
+
diff --git a/android/build.gradle b/android/build.gradle
index 9241302a15..b455140531 100644
--- a/android/build.gradle
+++ b/android/build.gradle
@@ -39,12 +39,13 @@ android {
versionName propVersionName
minSdkVersion propMinSdkVersion.toInteger()
targetSdkVersion propTargetSdkVersion.toInteger()
+ buildConfigField 'String', 'STATISTICS_URL', propStatisticsUrl
}
sourceSets.main {
manifest.srcFile 'AndroidManifest.xml'
- java.srcDirs = ['src']
res.srcDirs = ['res']
+ java.srcDirs = ['src', '../3party/Alohalytics/src/android/java']
// assets folder is auto-generated by tools/android/update_assets.sh, so we keep all static resources in separate folders.
assets.srcDirs = ['assets', 'assets-mrgs']
jniLibs.srcDirs = ['libs']
@@ -192,6 +193,7 @@ android {
jniDebuggable true // Enable jni debug build
zipAlignEnabled true
android.sourceSets.debug.setRoot('flavors/debug')
+ buildConfigField 'String', 'STATISTICS_URL', propStatisticsDevelopmentUrl
}
release {
@@ -206,6 +208,7 @@ android {
versionNameSuffix '-beta'
signingConfig signingConfigs.mapswithme
android.sourceSets.beta.setRoot('flavors/beta')
+ buildConfigField 'String', 'STATISTICS_URL', propStatisticsDevelopmentUrl
}
}
diff --git a/android/gradle.properties b/android/gradle.properties
index 911259e3be..27318546b2 100644
--- a/android/gradle.properties
+++ b/android/gradle.properties
@@ -12,3 +12,5 @@ libGooglePlayServicesPlus=com.google.android.gms:play-services-plus:6.5.+
libGradleAndroidPlugin=com.android.tools.build:gradle:1.0.+
libNineOldAndroids=com.nineoldandroids:library:2.4.0
libFacebookSdk=com.facebook.android:facebook-android-sdk:3.+
+propStatisticsUrl="http://localhost:8080/1"
+propStatisticsDevelopmentUrl="http://localhost:8080/dev"
\ No newline at end of file
diff --git a/android/jni/Android.mk b/android/jni/Android.mk
index 50f990e5f4..9d30d9bba0 100644
--- a/android/jni/Android.mk
+++ b/android/jni/Android.mk
@@ -137,7 +137,7 @@ include $(CLEAR_VARS)
LOCAL_CPP_FEATURES += exceptions rtti
LOCAL_MODULE := mapswithme
-LOCAL_STATIC_LIBRARIES := stats_client map gui routing search storage indexer graphics platform anim geometry coding base expat freetype fribidi zlib bzip2 jansson tomcrypt protobuf osrm
+LOCAL_STATIC_LIBRARIES := map gui routing search storage indexer graphics platform anim geometry coding base expat freetype fribidi zlib bzip2 jansson tomcrypt protobuf osrm stats_client
LOCAL_CFLAGS := -ffunction-sections -fdata-sections -Wno-extern-c-compat
ifneq ($(NDK_DEBUG),1)
diff --git a/android/jni/com/mapswithme/core/jni_helper.cpp b/android/jni/com/mapswithme/core/jni_helper.cpp
index 7c84c78885..6bc77d2434 100644
--- a/android/jni/com/mapswithme/core/jni_helper.cpp
+++ b/android/jni/com/mapswithme/core/jni_helper.cpp
@@ -3,8 +3,14 @@
#include "../../../../../base/assert.hpp"
+
static JavaVM * g_jvm = 0;
+extern JavaVM * GetJVM()
+{
+ return g_jvm;
+}
+
// @TODO remove after refactoring. Needed for NVidia code
void InitNVEvent(JavaVM * jvm);
diff --git a/map/map_tests/map_tests.pro b/map/map_tests/map_tests.pro
index 0ab1a26ff2..1968bb8e1d 100644
--- a/map/map_tests/map_tests.pro
+++ b/map/map_tests/map_tests.pro
@@ -7,7 +7,7 @@ TEMPLATE = app
ROOT_DIR = ../..
DEPENDENCIES = map gui routing search storage graphics indexer platform anim geometry coding base \
- freetype fribidi expat protobuf tomcrypt jansson zlib osrm
+ freetype fribidi expat protobuf tomcrypt jansson zlib osrm stats_client
drape {
DEPENDENCIES *= drape_frontend drape
diff --git a/map_server/map_server.pro b/map_server/map_server.pro
index 51efaca513..a29f9b41c0 100644
--- a/map_server/map_server.pro
+++ b/map_server/map_server.pro
@@ -6,7 +6,7 @@ TEMPLATE = app
DEFINES += QJSONRPC_BUILD
DEPENDENCIES = map gui routing search storage indexer graphics platform anim geometry coding base \
- osrm bzip2 freetype expat fribidi tomcrypt jansson protobuf qjsonrpc gflags zlib
+ osrm bzip2 freetype expat fribidi tomcrypt jansson protobuf qjsonrpc gflags zlib stats_client
drape {
DEPENDENCIES *= drape_frontend drape
diff --git a/qt/main.cpp b/qt/main.cpp
index 51ed6e6eda..000a5cfcc2 100644
--- a/qt/main.cpp
+++ b/qt/main.cpp
@@ -12,7 +12,10 @@
#include "../std/cstdio.hpp"
+#include "../3party/Alohalytics/src/alohalytics.h"
+
#include
+#include
#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
#include
@@ -64,10 +67,19 @@ int main(int argc, char * argv[])
QApplication a(argc, argv);
- (void)GetPlatform();
+ // Initialize platform-dependent code.
+ Platform & pl = GetPlatform();
+ // Initialize statistics engine.
+ string const statisticsDir = pl.WritableDir() + "stats/";
+ QDir().mkpath(statisticsDir.c_str());
+#ifdef DEBUG
+ alohalytics::Stats::Instance().SetDebugMode(true);
+#endif
+ alohalytics::Stats::Instance().SetClientId("D:" + pl.UniqueClientId())
+ .SetStoragePath(statisticsDir)
+ .SetServerUrl("http://stats.alohalytics.org/dev");
// checking default measurement system.
-
Settings::Units u;
if (!Settings::Get("Units", u))
diff --git a/qt/qt.pro b/qt/qt.pro
index c009297f19..9d30d2d11f 100644
--- a/qt/qt.pro
+++ b/qt/qt.pro
@@ -1,7 +1,7 @@
# Main application in qt.
ROOT_DIR = ..
DEPENDENCIES = map gui routing search storage indexer graphics platform anim geometry coding base \
- bzip2 freetype expat fribidi tomcrypt jansson protobuf zlib osrm
+ bzip2 freetype expat fribidi tomcrypt jansson protobuf zlib osrm stats_client
drape {
DEPENDENCIES *= drape_frontend drape
diff --git a/stats/stats.pro b/stats/stats.pro
index 62a8cea021..667567a696 100644
--- a/stats/stats.pro
+++ b/stats/stats.pro
@@ -9,6 +9,19 @@ include($$ROOT_DIR/common.pri)
DEPENDENCIES =
-SOURCES +=
+SOURCES += $$ROOT_DIR/3party/Alohalytics/src/cpp/alohalytics.cc \
-HEADERS +=
+HEADERS += $$ROOT_DIR/3party/Alohalytics/src/alohalytics.h \
+ $$ROOT_DIR/3party/Alohalytics/src/event_base.h \
+ $$ROOT_DIR/3party/Alohalytics/src/http_client.h \
+ $$ROOT_DIR/3party/Alohalytics/src/logger.h \
+
+macx-*|iphone* {
+ OBJECTIVE_SOURCES += $$ROOT_DIR/3party/Alohalytics/src/apple/http_client_apple.mm
+ QMAKE_OBJECTIVE_CFLAGS += -fobjc-arc
+} else:linux*|win* {
+ SOURCES += $$ROOT_DIR/3party/Alohalytics/src/posix/http_client_curl.cc
+} else:android* {
+ SOURCES += $$ROOT_DIR/3party/Alohalytics/src/android/jni/jni_alohalytics.cc
+}
+ # Android impl is included in jni/Android.mk