diff --git a/android/jni/com/mapswithme/maps/Framework.cpp b/android/jni/com/mapswithme/maps/Framework.cpp index b5d5dd68bf..2af40dddf8 100644 --- a/android/jni/com/mapswithme/maps/Framework.cpp +++ b/android/jni/com/mapswithme/maps/Framework.cpp @@ -10,6 +10,7 @@ #include "map/everywhere_search_params.hpp" #include "map/notifications/notification_queue.hpp" #include "map/user_mark.hpp" +#include "map/purchase.hpp" #include "partners_api/ads_engine.hpp" #include "partners_api/banner.hpp" @@ -1254,6 +1255,12 @@ Java_com_mapswithme_maps_Framework_nativeGetUserAgent(JNIEnv * env, jclass) return jni::ToJavaString(env, GetPlatform().GetAppUserAgent()); } +JNIEXPORT jstring JNICALL +Java_com_mapswithme_maps_Framework_nativeGetDeviceId(JNIEnv * env, jclass) +{ + return jni::ToJavaString(env, Purchase::GetDeviceId()); +} + JNIEXPORT jobjectArray JNICALL Java_com_mapswithme_maps_Framework_nativeGenerateNotifications(JNIEnv * env, jclass) { diff --git a/android/src/com/mapswithme/maps/Framework.java b/android/src/com/mapswithme/maps/Framework.java index b2e4f1ff93..475aca9b92 100644 --- a/android/src/com/mapswithme/maps/Framework.java +++ b/android/src/com/mapswithme/maps/Framework.java @@ -328,6 +328,8 @@ public class Framework public static native String nativeGetUserAgent(); + public static native String nativeGetDeviceId(); + @Nullable public static native RoutingInfo nativeGetRouteFollowingInfo(); diff --git a/android/src/com/mapswithme/maps/bookmarks/BookmarksDownloadManager.java b/android/src/com/mapswithme/maps/bookmarks/BookmarksDownloadManager.java index 066f735cc5..aebea855e9 100644 --- a/android/src/com/mapswithme/maps/bookmarks/BookmarksDownloadManager.java +++ b/android/src/com/mapswithme/maps/bookmarks/BookmarksDownloadManager.java @@ -55,6 +55,7 @@ public class BookmarksDownloadManager .Request(dstUri) .setNotificationVisibility(DownloadManager.Request.VISIBILITY_VISIBLE) .addRequestHeader(HttpClient.HEADER_USER_AGENT, Framework.nativeGetUserAgent()) + .addRequestHeader(HttpClient.HEADER_DEVICE_ID, Framework.nativeGetDeviceId()) .setDestinationInExternalFilesDir(mContext, null, dstUri.getLastPathSegment()); String accessToken = Framework.nativeGetAccessToken(); diff --git a/android/src/com/mapswithme/util/HttpClient.java b/android/src/com/mapswithme/util/HttpClient.java index 6732dbc06b..6ae7d455fb 100644 --- a/android/src/com/mapswithme/util/HttpClient.java +++ b/android/src/com/mapswithme/util/HttpClient.java @@ -57,6 +57,7 @@ public final class HttpClient public static final String HEADER_AUTHORIZATION = "Authorization"; public static final String HEADER_BEARER_PREFFIX = "Bearer "; public static final String HEADER_BUNDLE_TIERS = "X-Mapsme-Bundle-Tiers"; + public static final String HEADER_DEVICE_ID = "X-Mapsme-Device-Id"; private final static String TAG = HttpClient.class.getSimpleName(); // TODO(AlexZ): tune for larger files private final static int STREAM_BUFFER_SIZE = 1024 * 64;