Add cache path variable from Java
Use cache path for db location Add Assetbridge to extract asset files to cache path Fix SSL by using extracted ca bundle Use file:// style URL using extracted styles
This commit is contained in:
@@ -20,6 +20,8 @@
|
||||
namespace mbgl {
|
||||
namespace android {
|
||||
|
||||
std::string cache_path;
|
||||
|
||||
jmethodID on_map_changed_id = nullptr;
|
||||
|
||||
jclass lon_lat_class = nullptr;
|
||||
@@ -140,8 +142,9 @@ using namespace mbgl::android;
|
||||
// TODO: wrap C++ exceptions?
|
||||
// TODO: wrap other sorts of exceptions? eg coffee catch
|
||||
|
||||
jlong JNICALL nativeCreate(JNIEnv* env, jobject obj, jstring style_url, jstring api_key) {
|
||||
jlong JNICALL nativeCreate(JNIEnv* env, jobject obj, jstring cache_path_, jstring style_url, jstring api_key) {
|
||||
LOG_VERBOSE("nativeCreate");
|
||||
cache_path = std_string_from_jstring(env, cache_path_);
|
||||
NativeMapView* native_map_view = new NativeMapView(env, obj, std_string_from_jstring(env, style_url), std_string_from_jstring(env, api_key));
|
||||
if (native_map_view == nullptr) {
|
||||
throw_error(env, "Unable to create NativeMapView.");
|
||||
@@ -684,7 +687,7 @@ extern "C" JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM *vm, void *reserved) {
|
||||
|
||||
// NOTE: if you get java.lang.UnsatisfiedLinkError you likely forgot to set the size of the array correctly (too large)
|
||||
std::array<JNINativeMethod, 50> methods = {{ // Can remove the extra brace in C++14
|
||||
{ "nativeCreate", "(Ljava/lang/String;Ljava/lang/String;)J", reinterpret_cast<void*>(&nativeCreate) },
|
||||
{ "nativeCreate", "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)J", reinterpret_cast<void*>(&nativeCreate) },
|
||||
{ "nativeDestroy", "(J)V", reinterpret_cast<void*>(&nativeDestroy) },
|
||||
{ "nativeInitializeDisplay", "(J)V", reinterpret_cast<void*>(&nativeInitializeDisplay) },
|
||||
{ "nativeTerminateDisplay", "(J)V", reinterpret_cast<void*>(&nativeTerminateDisplay) },
|
||||
|
||||
Reference in New Issue
Block a user