summaryrefslogtreecommitdiff
path: root/platform/android/src/snapshotter/map_snapshot.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'platform/android/src/snapshotter/map_snapshot.cpp')
-rw-r--r--platform/android/src/snapshotter/map_snapshot.cpp7
1 files changed, 3 insertions, 4 deletions
diff --git a/platform/android/src/snapshotter/map_snapshot.cpp b/platform/android/src/snapshotter/map_snapshot.cpp
index 379ac89d52..d626ae68b7 100644
--- a/platform/android/src/snapshotter/map_snapshot.cpp
+++ b/platform/android/src/snapshotter/map_snapshot.cpp
@@ -38,21 +38,20 @@ jni::Object<MapSnapshot> MapSnapshot::New(JNIEnv& env,
auto bitmap = Bitmap::CreateBitmap(env, std::move(image));
// Create the Mapsnapshot peers
+ static auto javaClass = jni::Class<MapSnapshot>::Singleton(env);
static auto constructor = javaClass.GetConstructor<jni::jlong, jni::Object<Bitmap>, jni::Array<jni::String>, jni::jboolean>(env);
auto nativePeer = std::make_unique<MapSnapshot>(pixelRatio, pointForFn, latLngForFn);
return javaClass.New(env, constructor, reinterpret_cast<jlong>(nativePeer.release()), bitmap, conversion::toArray(env, attributions), (jni::jboolean) showLogo);
}
-jni::Class<MapSnapshot> MapSnapshot::javaClass;
-
void MapSnapshot::registerNative(jni::JNIEnv& env) {
// Lookup the class
- MapSnapshot::javaClass = *jni::Class<MapSnapshot>::Find(env).NewGlobalRef(env).release();
+ static auto javaClass = jni::Class<MapSnapshot>::Singleton(env);
#define METHOD(MethodPtr, name) jni::MakeNativePeerMethod<decltype(MethodPtr), (MethodPtr)>(name)
// Register the peer
- jni::RegisterNativePeer<MapSnapshot>(env, MapSnapshot::javaClass,
+ jni::RegisterNativePeer<MapSnapshot>(env, javaClass,
"nativePtr",
std::make_unique<MapSnapshot, JNIEnv&>,
"initialize",