67 lines
2.2 KiB
Java
67 lines
2.2 KiB
Java
package com.mogo.cloud;
|
||
|
||
import androidx.multidex.MultiDexApplication;
|
||
|
||
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.IMoGoTokenCallback;
|
||
import com.mogo.cloud.passport.MoGoAiCloudClient;
|
||
import com.mogo.cloud.passport.MoGoAiCloudClientConfig;
|
||
|
||
import org.jetbrains.annotations.Nullable;
|
||
|
||
import java.util.ArrayList;
|
||
import java.util.List;
|
||
import java.util.Random;
|
||
|
||
/**
|
||
*
|
||
*/
|
||
public class MoGoApplication extends MultiDexApplication {
|
||
|
||
|
||
@Override
|
||
public void onCreate() {
|
||
super.onCreate();
|
||
|
||
// TODO 这里是模拟数据,真实情况需要传入真实的经纬度信息
|
||
Random random = new Random();
|
||
double randomLat = random.nextDouble();
|
||
double randomLon = random.nextDouble();
|
||
|
||
/*
|
||
* 注:thridPartyKey 自有App :wbvpzgar
|
||
* BYD:bydauto
|
||
*/
|
||
// 配置云服务API
|
||
MoGoAiCloudClientConfig clientConfig = new MoGoAiCloudClientConfig();
|
||
// 设置网络环境:HTTP_DNS_ENV_QA、HTTP_DNS_ENV_RELEASE、HTTP_DNS_ENV_DEV
|
||
clientConfig.setNetMode(MogoHttpDnsConfig.HTTP_DNS_ENV_QA);
|
||
// 设置是否是第三APP登录
|
||
clientConfig.setThirdLogin(true);
|
||
// 设置是否输出日志
|
||
clientConfig.setShowDebugLog(true);
|
||
// 设置从蘑菇AI开放平台获取的APPKey
|
||
clientConfig.setThirdPartyAppKey("bydauto");
|
||
// 设置车机设备的唯一标识(这些表识必须是通过后台录入的设备)
|
||
clientConfig.setThirdPartyDeviceId("bydauto");
|
||
// 设置循环检测间隔时间
|
||
clientConfig.setLoopCheckDelay(15 * 1000);
|
||
|
||
// 设置DNS经纬度位置
|
||
clientConfig.setIHttpDnsCurrentLocation(new IHttpDnsCurrentLocation() {
|
||
@Nullable
|
||
@Override
|
||
public HttpDnsSimpleLocation getCurrentLocation() {
|
||
return new HttpDnsSimpleLocation("010", randomLat, randomLon);
|
||
}
|
||
});
|
||
|
||
// 初始化SDK,可以设置状态回调来监听
|
||
MoGoAiCloudClient.getInstance().init(
|
||
this, clientConfig);
|
||
|
||
}
|
||
}
|