[android] Added userAgent for bookmarks download manager

This commit is contained in:
Dmitry Donskoy 2018-08-08 15:29:15 +03:00 committed by Aleksey Belousov
parent 84ecf864c0
commit 4b62d73f88
3 changed files with 11 additions and 1 deletions

View file

@ -1043,6 +1043,12 @@ Java_com_mapswithme_maps_Framework_nativeDisableFollowing(JNIEnv * env, jclass)
frm()->GetRoutingManager().DisableFollowMode();
}
JNIEXPORT void JNICALL
Java_com_mapswithme_maps_Framework_nativeGetUserAgent(JNIEnv * env, jclass)
{
return static_cast<jstring>(GetPlatform().GetAppUserAgent());
}
JNIEXPORT jobjectArray JNICALL
Java_com_mapswithme_maps_Framework_nativeGenerateNotifications(JNIEnv * env, jclass)
{

View file

@ -293,6 +293,8 @@ public class Framework
public static native void nativeDisableFollowing();
public static native String nativeGetUserAgent();
@Nullable
public static native RoutingInfo nativeGetRouteFollowingInfo();

View file

@ -6,10 +6,11 @@ import android.net.Uri;
import android.support.annotation.NonNull;
import android.text.TextUtils;
import android.util.Pair;
import com.mapswithme.maps.Framework;
import com.mapswithme.maps.bookmarks.data.BookmarkManager;
import com.mapswithme.util.log.Logger;
import com.mapswithme.util.log.LoggerFactory;
import com.mopub.common.util.ResponseHeader;
import java.net.URLEncoder;
@ -50,6 +51,7 @@ public class BookmarksDownloadManager
.Request(dstUri)
.setNotificationVisibility(DownloadManager.Request.VISIBILITY_VISIBLE)
.setTitle(title)
.addRequestHeader(ResponseHeader.USER_AGENT.getKey(), Framework.nativeGetUserAgent())
.setDestinationInExternalFilesDir(mContext, null, dstUri.getLastPathSegment());
return downloadManager.enqueue(request);
}