修改mta接入,然而貌似并没有什么卵用
禁用tcagent的uncaught exception 上报
This commit is contained in:
@ -32,42 +32,51 @@ public class DataUtils {
|
||||
public static void init(Application context, final boolean debug, String channel) {
|
||||
|
||||
//TalkingData
|
||||
TCAgent.LOG_ON = debug;
|
||||
if (!debug) {
|
||||
TCAgent.init(context, Config.TD_APPID, channel);
|
||||
TCAgent.setReportUncaughtExceptions(true);
|
||||
} else {
|
||||
TCAgent.LOG_ON = true;
|
||||
//TODO 去除为了测试MTA的问题,这个版本不启用
|
||||
// TCAgent.setReportUncaughtExceptions(true);
|
||||
}
|
||||
|
||||
// 打开debug开关,可查看mta上报日志或错误
|
||||
// debug true release false
|
||||
StatConfig.setDebugEnable(debug);
|
||||
|
||||
//MTA
|
||||
StatService.setContext(context);
|
||||
StatService.registerActivityLifecycleCallbacks(context);
|
||||
if (!debug) {
|
||||
// 禁止MTA打印日志
|
||||
StatConfig.setDebugEnable(false);
|
||||
|
||||
//TODO 加入账号之后设置用户
|
||||
// StatConfig.setCustomUserId(context, "userid");
|
||||
|
||||
// 收集未处理的异常
|
||||
StatConfig.setAutoExceptionCaught(true);
|
||||
|
||||
StatConfig.setAntoActivityLifecycleStat(true);
|
||||
|
||||
// 设置数据上报策略
|
||||
StatConfig.setStatSendStrategy(StatReportStrategy.PERIOD);
|
||||
StatConfig.setSendPeriodMinutes(5);
|
||||
|
||||
StatConfig.init(context);
|
||||
StatConfig.setInstallChannel(channel);
|
||||
StatService.setContext(context);
|
||||
StatService.registerActivityLifecycleCallbacks(context);
|
||||
|
||||
StatCrashReporter crashReporter = StatCrashReporter.getStatCrashReporter(context);
|
||||
// 开启异常时的实时上报
|
||||
crashReporter.setEnableInstantReporting(true);
|
||||
// 开启java异常捕获
|
||||
crashReporter.setJavaCrashHandlerStatus(true);
|
||||
|
||||
try {
|
||||
// 开启收集服务
|
||||
StatService.startStatService(context, Config.MTA_APPKEY, com.tencent.stat.common.StatConstants.VERSION);
|
||||
} catch (MtaSDkException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
StatCrashReporter crashReporter = StatCrashReporter.getStatCrashReporter(context);
|
||||
// 开启异常时的实时上报
|
||||
crashReporter.setEnableInstantReporting(true);
|
||||
// 开启java异常捕获
|
||||
crashReporter.setJavaCrashHandlerStatus(true);
|
||||
} else {
|
||||
// 打开debug开关,可查看mta上报日志或错误
|
||||
// debug true release false
|
||||
StatConfig.setDebugEnable(true);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static void onEvent(Context var0, String var1, String var2) {
|
||||
@ -108,18 +117,18 @@ public class DataUtils {
|
||||
Map<String, Object> kv = new HashMap<>();
|
||||
kv.put("版本", platform);
|
||||
kv.put("状态", status);
|
||||
DataUtils.onEvent(context, "游戏下载", gameName, kv);
|
||||
onEvent(context, "游戏下载", gameName, kv);
|
||||
|
||||
Map<String, Object> kv2 = new HashMap<>();
|
||||
kv2.put("版本", platform);
|
||||
kv2.put("状态", status);
|
||||
kv2.put("位置", entrance);
|
||||
DataUtils.onEvent(context, "游戏下载位置", gameName, kv2);
|
||||
onEvent(context, "游戏下载位置", gameName, kv2);
|
||||
|
||||
Map<String, Object> kv3 = new HashMap<>();
|
||||
kv3.put(entrance, "下载数");
|
||||
kv3.put(entrance, status);
|
||||
DataUtils.onEvent(context, "应用数据", gameName, kv3);
|
||||
onEvent(context, "应用数据", gameName, kv3);
|
||||
}
|
||||
|
||||
// 游戏更新
|
||||
@ -127,7 +136,7 @@ public class DataUtils {
|
||||
Map<String, Object> kv = new HashMap<>();
|
||||
kv.put("版本", paltform);
|
||||
kv.put("状态", status);
|
||||
DataUtils.onEvent(context, "游戏更新", gameName, kv);
|
||||
onEvent(context, "游戏更新", gameName, kv);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user