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

Commit

Permalink
set missing release, env and dist to sentry-native options (#404)
Browse files Browse the repository at this point in the history
  • Loading branch information
marandaneto authored May 11, 2020
1 parent a964978 commit a0b5f57
Showing 1 changed file with 20 additions and 0 deletions.
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);
}

0 comments on commit a0b5f57

Please sign in to comment.