Skip to content
This repository was archived by the owner on Aug 30, 2023. It is now read-only.
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
fix merge conflict
  • Loading branch information
Manoel Aranda Neto committed Oct 24, 2019
commit 773364863a10da7c35e717cd66ab45aac236b38f
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import android.content.Context;
import io.sentry.core.ILogger;
import io.sentry.core.MainEventProcessor;
import io.sentry.core.SentryLevel;
import io.sentry.core.SentryOptions;
import java.io.File;
import java.lang.reflect.Method;
Expand All @@ -20,12 +20,40 @@ static void init(SentryOptions options, Context context, ILogger logger) {
options.setSentryClientName("sentry.java.android/0.0.1");

ManifestMetadataReader.applyMetadata(context, options);
addProcessors(options, context);
createsEnvelopeDirPath(options, context);

if (options.isEnableNdk()) {
try {
// TODO: Create Integrations interface and use that to initialize NDK
Class<?> cls = Class.forName("io.sentry.android.ndk.SentryNdk");

// TODO: temporary hack
String cacheDirPath = context.getCacheDir().getAbsolutePath() + "/sentry-envelopes";
File f = new File(cacheDirPath);
f.mkdirs();

Method method = cls.getMethod("init", SentryOptions.class, String.class);
Object[] args = new Object[2];
args[0] = options;
args[1] = cacheDirPath;
method.invoke(null, args);
} catch (ClassNotFoundException exc) {
options.getLogger().log(SentryLevel.ERROR, "Failed to load SentryNdk.");
} catch (Exception e) {
options.getLogger().log(SentryLevel.ERROR, "Failed to initialize SentryNdk.", e);
}
}

options.addEventProcessor(new DefaultAndroidEventProcessor(context, options));
options.setSerializer(new AndroidSerializer(options.getLogger()));
}

private static void addProcessors(SentryOptions options, Context context) {
options.addEventProcessor(new MainEventProcessor(options));
options.addEventProcessor(new DefaultAndroidEventProcessor(context, options));
private static void createsEnvelopeDirPath(SentryOptions options, Context context) {
File cacheDir = context.getCacheDir().getAbsoluteFile();
File envelopesDir = new File(cacheDir, "sentry-envelopes");
if (!envelopesDir.exists()) {
envelopesDir.mkdirs();
}
options.setCacheDirPath(envelopesDir.getAbsolutePath());
}
}
You are viewing a condensed version of this merge commit. You can view the full changes here.