[Add] 增加应用启动时间统计上报
Signed-off-by: donghongyu <donghongyu@zhidaoauto.com>
This commit is contained in:
@@ -31,6 +31,7 @@ import com.mogo.map.location.IMogoLocationListener;
|
||||
import com.mogo.map.uicontroller.EnumMapUI;
|
||||
import com.mogo.module.common.MogoApisHandler;
|
||||
import com.mogo.module.common.api.CallChatApi;
|
||||
import com.mogo.module.common.enums.EventTypeEnum;
|
||||
import com.mogo.module.common.map.MapCenterPointStrategy;
|
||||
import com.mogo.module.common.map.Scene;
|
||||
import com.mogo.module.main.cards.MogoModulesManager;
|
||||
@@ -51,6 +52,9 @@ import com.zhidao.adasconfig.api.AdasConfigApiController;
|
||||
import com.zhidao.adasconfig.common.log.LoggerController;
|
||||
import com.zhidao.autopilot.support.api.AutopilotServiceManage;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2019-12-23
|
||||
@@ -176,6 +180,8 @@ public class MainActivity extends MvpActivity<MainView, MainPresenter> implement
|
||||
@Override
|
||||
public void onWindowFocusChanged(boolean hasFocus) {
|
||||
if (hasFocus) {
|
||||
// 统计代码
|
||||
final Map<String, Object> properties = new HashMap<>();
|
||||
long hotStartTime = AppLaunchTimeUtils.getTimeCalculate(AppLaunchTimeUtils.HOT_START);
|
||||
if (AppLaunchTimeUtils.sColdStartTime > 0 && hotStartTime > 0) {
|
||||
// 真正的冷启动时间 = Application启动时间 + 热启动时间
|
||||
@@ -184,14 +190,17 @@ public class MainActivity extends MvpActivity<MainView, MainPresenter> implement
|
||||
if (coldStartTime < 50000) {
|
||||
// 上传冷启动时间coldStartTime
|
||||
Logger.i(TAG, "coldStartTime:" + coldStartTime);
|
||||
properties.put("app_launch_coldStartTime", coldStartTime);
|
||||
}
|
||||
} else if (hotStartTime > 0) {
|
||||
// 过滤掉异常启动时间
|
||||
if (hotStartTime < 30000) {
|
||||
// 上传热启动时间hotStartTime
|
||||
Logger.i(TAG, "hotStartTime:" + hotStartTime);
|
||||
properties.put("app_launch_hotStartTime", hotStartTime);
|
||||
}
|
||||
}
|
||||
MogoApisHandler.getInstance().getApis().getAnalyticsApi().track("app_launch_time", properties);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user