Skip to content
This repository has been archived by the owner on Aug 30, 2023. It is now read-only.

fix: set missing release, environment and dist to sentry-native options #404

Merged
merged 1 commit into from
May 11, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions sentry-android-ndk/src/main/jni/sentry.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,15 @@ JNIEXPORT void JNICALL Java_io_sentry_android_ndk_SentryNdk_initSentryNative(JNI
jmethodID is_debug_mid = (*env)->GetMethodID(env, options_cls, "isDebug", "()Z");
g_transport_options.debug = (*env)->CallBooleanMethod(env, sentry_sdk_options, is_debug_mid);

jmethodID release_mid = (*env)->GetMethodID(env, options_cls, "getRelease", "()Ljava/lang/String;");
jstring release = (jstring)(*env)->CallObjectMethod(env, sentry_sdk_options, release_mid);

jmethodID environment_mid = (*env)->GetMethodID(env, options_cls, "getEnvironment", "()Ljava/lang/String;");
jstring environment = (jstring)(*env)->CallObjectMethod(env, sentry_sdk_options, environment_mid);

jmethodID dist_mid = (*env)->GetMethodID(env, options_cls, "getDist", "()Ljava/lang/String;");
jstring dist = (jstring)(*env)->CallObjectMethod(env, sentry_sdk_options, dist_mid);

g_transport_options.env = env;
g_transport_options.cls = cls;

Expand All @@ -56,5 +65,16 @@ JNIEXPORT void JNICALL Java_io_sentry_android_ndk_SentryNdk_initSentryNative(JNI
options, sentry_new_function_transport(send_envelope, NULL));
sentry_options_set_debug(options, g_transport_options.debug);
sentry_options_set_dsn(options, (*env)->GetStringUTFChars(env, dsn, 0));

if (release != NULL) {
sentry_options_set_release(options, (*env)->GetStringUTFChars(env, release, 0));
}
if (environment != NULL) {
sentry_options_set_environment(options, (*env)->GetStringUTFChars(env, environment, 0));
}
if (dist != NULL) {
sentry_options_set_dist(options, (*env)->GetStringUTFChars(env, dist, 0));
}

sentry_init(options);
}