[6.8.4]
1、对 Countly 初始化进行宜昌捕获
This commit is contained in:
@@ -63,65 +63,69 @@ public class MogoApplication extends MainMoGoApplication {
|
||||
//设置debug模式,日志不上传
|
||||
crashSystem.setDebug(BuildConfig.DEBUG);
|
||||
|
||||
if (BuildConfig.DEBUG){
|
||||
// debug测试用的key
|
||||
COUNTLY_APP_KEY = "d8cfb7be4679f650a6dc806d289a0d8c1996ed05";
|
||||
try {
|
||||
if (BuildConfig.DEBUG) {
|
||||
// debug测试用的key
|
||||
COUNTLY_APP_KEY = "d8cfb7be4679f650a6dc806d289a0d8c1996ed05";
|
||||
}
|
||||
|
||||
// 初始化自建APM统计 Countly
|
||||
CountlyConfig countlyConfig =
|
||||
// 创建配置对象
|
||||
new CountlyConfig(
|
||||
this,
|
||||
COUNTLY_APP_KEY,
|
||||
COUNTLY_SERVER_URL
|
||||
);
|
||||
// 优先获取设备在 蘑菇平台注册的SN
|
||||
String devicesID = SharedPrefsMgr.getInstance().getSn();
|
||||
// 如果拿不到 蘑菇SN,则使用设备自己的序列号
|
||||
if (TextUtils.isEmpty(devicesID)) {
|
||||
devicesID = DeviceUtils.getDeviceSN();
|
||||
}
|
||||
|
||||
// 设置设备唯一标志
|
||||
countlyConfig.setDeviceId(devicesID)
|
||||
// 获取您在 Countly 服务器中设置的一些配置
|
||||
.enableServerConfiguration()
|
||||
// 自动视图跟踪
|
||||
.enableAutomaticViewTracking()
|
||||
.enableAutomaticViewShortNames()
|
||||
.enableTemporaryDeviceIdMode()
|
||||
// 参数篡改保护,salt
|
||||
.setParameterTamperingProtectionSalt("mogo_auto")
|
||||
// 如果发送到服务器的数据足够短,SDK 将使用 HTTP GET 请求。要覆盖该行为,
|
||||
// 以便在所有情况下都使用 HTTP POST 请求,您需要在 init 配置中将“setHttpPostForced”标志设置为 true。
|
||||
.setHttpPostForced(true)
|
||||
// 启用日志记录:
|
||||
.setLoggingEnabled(true);
|
||||
|
||||
// 限制每个线程记录的堆栈跟踪行(默认值:30 行)
|
||||
countlyConfig.sdkInternalLimits.setMaxStackTraceLinesPerThread(10000);
|
||||
// 限制每个堆栈跟踪行允许的字符(默认:200 个字符)
|
||||
countlyConfig.sdkInternalLimits.setMaxStackTraceLineLength(10000);
|
||||
// 限制所有用户设置的字符串分段(或其等效值)值的大小(默认值:256 个字符)
|
||||
countlyConfig.sdkInternalLimits.setMaxValueSize(10000);
|
||||
// 限制用户设置的分段键值对的数量(默认:100 个条目)
|
||||
countlyConfig.sdkInternalLimits.setMaxSegmentationValues(1000);
|
||||
// 限制可以记录的用户设置痕迹导航的数量(默认值:100 个条目,超过此值将删除最早的条目)
|
||||
countlyConfig.sdkInternalLimits.setMaxBreadcrumbCount(1000);
|
||||
|
||||
// 自动崩溃处理
|
||||
countlyConfig.crashes.enableCrashReporting();
|
||||
// 记录所有线程
|
||||
countlyConfig.crashes.enableRecordAllThreadsWithCrash();
|
||||
|
||||
// 初始化Countly SDK配置
|
||||
Countly.sharedInstance().init(countlyConfig);
|
||||
// java崩溃报告
|
||||
Countly.sharedInstance().crashes();
|
||||
// C++ 崩溃报告
|
||||
CountlyNative.initNative(this);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
// 初始化自建APM统计 Countly
|
||||
CountlyConfig countlyConfig =
|
||||
// 创建配置对象
|
||||
new CountlyConfig(
|
||||
this,
|
||||
COUNTLY_APP_KEY,
|
||||
COUNTLY_SERVER_URL
|
||||
);
|
||||
// 优先获取设备在 蘑菇平台注册的SN
|
||||
String devicesID = SharedPrefsMgr.getInstance().getSn();
|
||||
// 如果拿不到 蘑菇SN,则使用设备自己的序列号
|
||||
if (TextUtils.isEmpty(devicesID)) {
|
||||
devicesID = DeviceUtils.getDeviceSN();
|
||||
}
|
||||
|
||||
// 设置设备唯一标志
|
||||
countlyConfig.setDeviceId(devicesID)
|
||||
// 获取您在 Countly 服务器中设置的一些配置
|
||||
.enableServerConfiguration()
|
||||
// 自动视图跟踪
|
||||
.enableAutomaticViewTracking()
|
||||
.enableAutomaticViewShortNames()
|
||||
.enableTemporaryDeviceIdMode()
|
||||
// 参数篡改保护,salt
|
||||
.setParameterTamperingProtectionSalt("mogo_auto")
|
||||
// 如果发送到服务器的数据足够短,SDK 将使用 HTTP GET 请求。要覆盖该行为,
|
||||
// 以便在所有情况下都使用 HTTP POST 请求,您需要在 init 配置中将“setHttpPostForced”标志设置为 true。
|
||||
.setHttpPostForced(true)
|
||||
// 启用日志记录:
|
||||
.setLoggingEnabled(true);
|
||||
|
||||
// 限制每个线程记录的堆栈跟踪行(默认值:30 行)
|
||||
countlyConfig.sdkInternalLimits.setMaxStackTraceLinesPerThread(10000);
|
||||
// 限制每个堆栈跟踪行允许的字符(默认:200 个字符)
|
||||
countlyConfig.sdkInternalLimits.setMaxStackTraceLineLength(10000);
|
||||
// 限制所有用户设置的字符串分段(或其等效值)值的大小(默认值:256 个字符)
|
||||
countlyConfig.sdkInternalLimits.setMaxValueSize(10000);
|
||||
// 限制用户设置的分段键值对的数量(默认:100 个条目)
|
||||
countlyConfig.sdkInternalLimits.setMaxSegmentationValues(1000);
|
||||
// 限制可以记录的用户设置痕迹导航的数量(默认值:100 个条目,超过此值将删除最早的条目)
|
||||
countlyConfig.sdkInternalLimits.setMaxBreadcrumbCount(1000);
|
||||
|
||||
// 自动崩溃处理
|
||||
countlyConfig.crashes.enableCrashReporting();
|
||||
// 记录所有线程
|
||||
countlyConfig.crashes.enableRecordAllThreadsWithCrash();
|
||||
|
||||
// 初始化Countly SDK配置
|
||||
Countly.sharedInstance().init(countlyConfig);
|
||||
// java崩溃报告
|
||||
Countly.sharedInstance().crashes();
|
||||
// C++ 崩溃报告
|
||||
CountlyNative.initNative(this);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user