接入 Sentry

This commit is contained in:
juntao
2020-11-18 11:54:19 +08:00
parent a1dee46436
commit 8b22361213
7 changed files with 131 additions and 47 deletions

View File

@ -26,6 +26,8 @@ import java.util.HashMap;
import java.util.Map;
import java.util.Properties;
import io.sentry.android.core.SentryAndroid;
/**
* Created by LGT on 2016/6/15.
* 数据收集 工具类 TalkingData、MTA
@ -43,6 +45,27 @@ public class DataUtils {
if (CommonDebug.IS_DEBUG) {
return;
}
SentryAndroid.init(context, options -> {
if (BuildConfig.BUILD_TIME != 0L) {
options.setRelease("内测版" + BuildConfig.BUILD_TIME);
} else {
options.setRelease(channel);
}
options.setDebug(BuildConfig.DEBUG);
options.setEnableSessionTracking(true);
options.setEnvironment(BuildConfig.FLAVOR);
options.setDsn("https://6b1caf0d17c1408e8680f3f73ff80bd0@sentry.ghzs.com/22");
options.setBeforeSend((event, hint) -> {
if (BuildConfig.DEBUG) {
return null;
} else {
return event;
}
});
});
//TalkingData
// try {
// TCAgent.LOG_ON = false;