dev
This commit is contained in:
@@ -2,6 +2,12 @@ package com.mogo.commons;
|
||||
|
||||
import android.app.Application;
|
||||
|
||||
import com.alibaba.android.arouter.launcher.ARouter;
|
||||
import com.elegant.analytics.Analytics;
|
||||
import com.elegant.analytics.AnalyticsConfig;
|
||||
import com.mogo.commons.debug.DebugConfig;
|
||||
import com.mogo.utils.TipToast;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2019-12-23
|
||||
@@ -12,13 +18,36 @@ public class AbsMogoApplication extends Application {
|
||||
|
||||
private static Application sApp;
|
||||
|
||||
public static Application getApp() {
|
||||
return sApp;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreate() {
|
||||
super.onCreate();
|
||||
sApp = this;
|
||||
init();
|
||||
}
|
||||
|
||||
public static Application getApp() {
|
||||
return sApp;
|
||||
protected void init() {
|
||||
|
||||
// 初始化埋点
|
||||
Analytics.getInstance().start( sApp );
|
||||
// 0 - debug 近实时上报,积累一条埋点上报,或者积累3秒上报一次。
|
||||
// 2 - 本地缓存,聚合上报,积累30条埋点上报,或者积累60秒上报一次。
|
||||
Analytics.getInstance().start( sApp );
|
||||
AnalyticsConfig.getInstance( sApp ).setMode( DebugConfig.isDebug() ? 0 : 2 );
|
||||
AnalyticsConfig.getInstance( sApp ).shouldLog( DebugConfig.isDebug() );
|
||||
|
||||
// 初始化 arouter
|
||||
if ( DebugConfig.isDebug() ) {
|
||||
ARouter.openDebug();
|
||||
ARouter.openLog();
|
||||
}
|
||||
ARouter.init( sApp );
|
||||
|
||||
// 初始化toast
|
||||
TipToast.init( sApp, null );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user