summaryrefslogtreecommitdiff
path: root/platform/android/src/file_source.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'platform/android/src/file_source.cpp')
-rw-r--r--platform/android/src/file_source.cpp13
1 files changed, 8 insertions, 5 deletions
diff --git a/platform/android/src/file_source.cpp b/platform/android/src/file_source.cpp
index 20715bf920..16c09b7b52 100644
--- a/platform/android/src/file_source.cpp
+++ b/platform/android/src/file_source.cpp
@@ -2,21 +2,24 @@
#include <mbgl/util/logging.hpp>
-#include <string>
-
+#include "asset_manager_file_source.hpp"
#include "jni/generic_global_ref_deleter.hpp"
+#include <string>
namespace mbgl {
namespace android {
// FileSource //
-FileSource::FileSource(jni::JNIEnv& _env, jni::String accessToken, jni::String _cachePath, jni::String _apkPath) {
+FileSource::FileSource(jni::JNIEnv& _env,
+ jni::String accessToken,
+ jni::String _cachePath,
+ jni::Object<AssetManager> assetManager) {
// Create a core default file source
fileSource = std::make_unique<mbgl::DefaultFileSource>(
jni::Make<std::string>(_env, _cachePath) + "/mbgl-offline.db",
- jni::Make<std::string>(_env, _apkPath));
+ std::make_unique<AssetManagerFileSource>(_env, assetManager));
// Set access token
fileSource->setAccessToken(jni::Make<std::string>(_env, accessToken));
@@ -80,7 +83,7 @@ void FileSource::registerNative(jni::JNIEnv& env) {
// Register the peer
jni::RegisterNativePeer<FileSource>(
env, FileSource::javaClass, "nativePtr",
- std::make_unique<FileSource, JNIEnv&, jni::String, jni::String, jni::String>,
+ std::make_unique<FileSource, JNIEnv&, jni::String, jni::String, jni::Object<AssetManager>>,
"initialize",
"finalize",
METHOD(&FileSource::getAccessToken, "getAccessToken"),