增加eventbus混淆

This commit is contained in:
kehaoyuan
2017-06-12 15:08:48 +08:00
parent 1a6966e522
commit 8b46435808
10 changed files with 42 additions and 11 deletions

View File

@ -1,11 +1,13 @@
package com.gh.common.util;
import android.app.Activity;
import android.app.Application;
import android.content.Context;
import com.gh.common.constant.Config;
import com.tencent.stat.MtaSDkException;
import com.tencent.stat.StatConfig;
import com.tencent.stat.StatCrashReporter;
import com.tencent.stat.StatReportStrategy;
import com.tencent.stat.StatService;
import com.tendcloud.tenddata.TCAgent;
@ -27,7 +29,7 @@ public class DataUtils {
* @param debug 是否debug模式
* @param channel
*/
public static void init(Context context, final boolean debug, String channel) {
public static void init(Application context, final boolean debug, String channel) {
//TalkingData
if (!debug) {
@ -38,18 +40,29 @@ public class DataUtils {
}
//MTA
StatService.setContext(context);
StatService.registerActivityLifecycleCallbacks(context);
if (!debug) {
// 禁止MTA打印日志
StatConfig.setDebugEnable(false);
// 收集未处理的异常
StatConfig.setAutoExceptionCaught(true);
// 设置数据上报策略
StatConfig.setStatSendStrategy(StatReportStrategy.PERIOD);
StatConfig.setSendPeriodMinutes(5);
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上报日志或错误
// dubug true release false