Files
MoGoAiCloudSdk/app/src/main/java/com/mogo/cloud/MoGoApplication.java
2021-03-29 17:08:39 +08:00

77 lines
2.8 KiB
Java
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
package com.mogo.cloud;
import android.support.annotation.Nullable;
import android.support.multidex.MultiDexApplication;
import com.auto.zhidao.logsdk.CrashSystem;
import com.mogo.cloud.httpdns.MogoHttpDnsConfig;
import com.mogo.cloud.httpdns.bean.HttpDnsSimpleLocation;
import com.mogo.cloud.httpdns.listener.IHttpDnsCurrentLocation;
import com.mogo.cloud.passport.MoGoAiCloudClient;
import com.mogo.cloud.passport.MoGoAiCloudClientConfig;
import com.mogo.cloud.util.Devices;
import java.util.Random;
/**
*
*/
public class MoGoApplication extends MultiDexApplication {
@Override
public void onCreate() {
super.onCreate();
// Crash 日志收集
CrashSystem crashSystem = CrashSystem.getInstance(this);
crashSystem.init();
//设置debug模式日志不上传
crashSystem.setDebug(BuildConfig.DEBUG);
// TODO 这里是模拟数据,真实情况需要传入真实的经纬度信息
Random random = new Random();
double randomLat = random.nextDouble();
double randomLon = random.nextDouble();
/*
* 注thridPartyKey 自有App wbvpzgar
* BYDbydauto
*/
// 配置云服务API
MoGoAiCloudClientConfig clientConfig = MoGoAiCloudClientConfig.getInstance();
// 设置网络环境HTTP_DNS_ENV_QA、HTTP_DNS_ENV_RELEASE、HTTP_DNS_ENV_DEV
clientConfig.setNetMode(MogoHttpDnsConfig.HTTP_DNS_ENV_QA);
// 设置是否是第三APP登录false自有车机 true外部三方车机
clientConfig.setThirdLogin(true);
// 设置是否输出日志
clientConfig.setShowDebugLog(true);
// 设置从蘑菇AI开放平台获取的APPKey
clientConfig.setThirdPartyAppKey("wbvpzgar");
// 设置AI云平台分配给三方应用的签名密钥需要从AI云平台申请
// 设置车机设备的唯一标识(这些表识必须是通过后台录入的设备)
clientConfig.setThirdPartyDeviceId(Devices.getSn());
// 设置应用服务AppId 长链、鉴权 //todo 需要卸载智慧驾驶、行车记录仪
clientConfig.setServiceAppId("com.mogo.test");
// 设置循环检测间隔时间
clientConfig.setLoopCheckDelay(15 * 1000);
// 设置是否属于高精定位设备
clientConfig.setIsAccuracyDevice(false);
// 设置DNS经纬度位置
clientConfig.setIHttpDnsCurrentLocation(new IHttpDnsCurrentLocation() {
@Nullable
@Override
public HttpDnsSimpleLocation getCurrentLocation() {
return new HttpDnsSimpleLocation("010", randomLat, randomLon);
}
});
// 初始化SDK可以设置状态回调来监听
MoGoAiCloudClient.getInstance().init(this, clientConfig);
}
}