「Fix 」
1、删除自定义DNS。对网络请求TryCatch
This commit is contained in:
@@ -59,6 +59,7 @@ public class RequestLiveManager {
|
||||
* @param requestLiveListener {@link IRequestLiveListener}
|
||||
*/
|
||||
public void requestDesignativeVehicleLive(String type, String liveSn, IRequestLiveListener requestLiveListener) {
|
||||
try {
|
||||
Gson gson = new Gson();
|
||||
LivePush livePush = new LivePush(liveSn, type, FRONT_CAMERA);
|
||||
String sn = MoGoAiCloudClient.getInstance().getAiCloudClientConfig().getSn();
|
||||
@@ -96,6 +97,9 @@ public class RequestLiveManager {
|
||||
if (requestLiveListener != null) {
|
||||
requestLiveListener.onSuccess();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -107,6 +111,7 @@ public class RequestLiveManager {
|
||||
* @param requestLiveListener {@link IRequestLiveListener}
|
||||
*/
|
||||
public void requestFrontVehicleLive(double lat, double lon, int bearing, IRequestLiveListener requestLiveListener) {
|
||||
try {
|
||||
Gson gson = new Gson();
|
||||
String sn = MoGoAiCloudClient.getInstance().getAiCloudClientConfig().getSn();
|
||||
LivePush livePush = new LivePush(sn, FRONT_CAMERA, lat, lon, bearing);
|
||||
@@ -149,6 +154,9 @@ public class RequestLiveManager {
|
||||
|
||||
}
|
||||
});
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -160,6 +168,7 @@ public class RequestLiveManager {
|
||||
* @param requestLiveListener {@link IRequestLiveListener}
|
||||
*/
|
||||
public void requestFrontIntersectionLive(double lat, double lon, int bearing, IRequestLiveListener requestLiveListener) {
|
||||
try {
|
||||
Gson gson = new Gson();
|
||||
String sn = MoGoAiCloudClient.getInstance().getAiCloudClientConfig().getSn();
|
||||
LivePush livePush = new LivePush(sn, lat, lon, bearing);
|
||||
@@ -202,6 +211,9 @@ public class RequestLiveManager {
|
||||
|
||||
}
|
||||
});
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -211,6 +223,7 @@ public class RequestLiveManager {
|
||||
* @param requestLiveListener {@link IRequestLiveListener}
|
||||
*/
|
||||
public void requestDesignativeIntersectionLive(String cameraId, IRequestLiveListener requestLiveListener) {
|
||||
try {
|
||||
Gson gson = new Gson();
|
||||
String sn = MoGoAiCloudClient.getInstance().getAiCloudClientConfig().getSn();
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
@@ -252,6 +265,9 @@ public class RequestLiveManager {
|
||||
|
||||
}
|
||||
});
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -46,25 +46,7 @@ class OkHttpFactory private constructor() {
|
||||
.writeTimeout(WRITE_TIMEOUT, TimeUnit.MILLISECONDS)
|
||||
.eventListenerFactory(WeakNetworkEventFactory.FACTORY)
|
||||
.dispatcher(dispatcher)
|
||||
// 可选:添加自定义 DNS 解析逻辑
|
||||
.dns(CustomDns()) // 使用系统默认 DNS 或者自定义 Dns 实现
|
||||
.build()
|
||||
}
|
||||
}
|
||||
|
||||
class CustomDns : Dns {
|
||||
override fun lookup(hostname: String): List<InetAddress> {
|
||||
return try {
|
||||
Log.d("CustomDns", "Lookup resolve host: $hostname")
|
||||
// 使用默认的 DNS 解析逻辑
|
||||
Dns.SYSTEM.lookup(hostname)
|
||||
} catch (uhe: UnknownHostException) {
|
||||
// 处理 UnknownHostException
|
||||
// 在这里记录日志、通知用户或其他处理方式
|
||||
Log.e("CustomDns", "Unable to resolve host: $hostname", uhe)
|
||||
// 返回空列表表示无法解析
|
||||
emptyList()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -74,8 +74,12 @@ object V2XManager {
|
||||
|
||||
private val refreshTask = object : Runnable {
|
||||
override fun run() {
|
||||
try {
|
||||
V2XRefreshModel.querySnapshot(longitude = this@V2XManager.realLongitude.get(), latitude = this@V2XManager.realLatitude.get(), refreshCallback)
|
||||
handler.postDelayed(this, config.get().durationForTriggerRefresh)
|
||||
} catch (e: Exception) {
|
||||
e.printStackTrace()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -15,10 +15,6 @@ import com.mogo.v2x.utils.DeviceUtils
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers
|
||||
import io.reactivex.disposables.Disposable
|
||||
import io.reactivex.schedulers.Schedulers
|
||||
import retrofit2.Retrofit
|
||||
import retrofit2.adapter.rxjava2.RxJava2CallAdapterFactory
|
||||
import retrofit2.converter.gson.GsonConverterFactory
|
||||
import java.util.concurrent.atomic.AtomicReference
|
||||
|
||||
internal class V2XRefreshModel {
|
||||
|
||||
|
||||
@@ -33,30 +33,30 @@ SNAPSHOT_REPOSITORY_URL=http://nexus.zhidaoauto.com/repository/maven-snapshots/
|
||||
USERNAME=xintai
|
||||
PASSWORD=xintai2018
|
||||
# 编译模式: false - 依赖本地版本, true - 依赖 maven 版本
|
||||
RELEASE=false
|
||||
RELEASE=true
|
||||
# AI CLOUD 云平台
|
||||
# 工具类
|
||||
MOGO_UTILS_VERSION=1.4.7.59
|
||||
MOGO_UTILS_VERSION=1.4.7.62
|
||||
# 网络请求
|
||||
MOGO_NETWORK_VERSION=1.4.7.59
|
||||
MOGO_NETWORK_VERSION=1.4.7.62
|
||||
# 鉴权
|
||||
MOGO_PASSPORT_VERSION=1.4.7.59
|
||||
MOGO_PASSPORT_VERSION=1.4.7.62
|
||||
# 常链接
|
||||
MOGO_SOCKET_VERSION=1.4.7.59
|
||||
MOGO_SOCKET_VERSION=1.4.7.62
|
||||
# 数据采集
|
||||
MOGO_REALTIME_VERSION=1.4.7.59
|
||||
MOGO_REALTIME_VERSION=1.4.7.62
|
||||
# 探路,道路事件发布,获取
|
||||
MOGO_TANLU_VERSION=1.4.7.59
|
||||
MOGO_TANLU_VERSION=1.4.7.62
|
||||
# 直播推流
|
||||
MOGO_LIVE_VERSION=1.4.7.59
|
||||
MOGO_LIVE_VERSION=1.4.7.62
|
||||
# 直播拉流
|
||||
MOGO_TRAFFICLIVE_VERSION=1.4.7.59
|
||||
MOGO_TRAFFICLIVE_VERSION=1.4.7.62
|
||||
# 定位服务
|
||||
MOGO_LOCATION_VERSION=1.4.7.59
|
||||
MOGO_LOCATION_VERSION=1.4.7.62
|
||||
# 远程通讯模块
|
||||
MOGO_TELEMATIC_VERSION=1.4.7.59
|
||||
MOGO_TELEMATIC_VERSION=1.4.7.62
|
||||
# v2x
|
||||
MOGO_V2X_VERSION=1.4.7.59
|
||||
MOGO_V2X_VERSION=1.4.7.62
|
||||
# SKIN
|
||||
MOGO_SKIN_VERSION=1.4.7.50
|
||||
# SDK
|
||||
@@ -75,7 +75,7 @@ SONATYPE_HOST=S01
|
||||
RELEASE_SIGNING_ENABLED=false
|
||||
# 组织名
|
||||
GROUP=com.mogo.cloud
|
||||
VERSION_NAME=1.4.7.59
|
||||
VERSION_NAME=1.4.7.62
|
||||
# 主页
|
||||
POM_URL=https://gitlab.zhidaoauto.com/SCA/L4HA/AndroidApp/support/countly-sdk-android
|
||||
# 版本控制信息
|
||||
|
||||
@@ -61,6 +61,7 @@ public class MogoRoadSearchManager {
|
||||
* @param callback {@link IRoadInfoSearchCallback}
|
||||
*/
|
||||
public void queryRoadInfo(RoadInfoRequest roadInfoRequest, IRoadInfoSearchCallback callback) {
|
||||
try {
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("sn", MoGoAiCloudClient.getInstance().getAiCloudClientConfig().getSn());
|
||||
map.put("data", GsonUtil.jsonFromObject(roadInfoRequest));
|
||||
@@ -89,6 +90,9 @@ public class MogoRoadSearchManager {
|
||||
|
||||
}
|
||||
});
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -56,6 +56,7 @@ public class UploadManager {
|
||||
* @param callback
|
||||
*/
|
||||
public void loadUpload(InformationBody informationBody, ITanluUploadCallback callback) {
|
||||
try {
|
||||
Gson gson = new Gson();
|
||||
Map<String, String> map = new HashMap<>();
|
||||
map.put("sn", MoGoAiCloudClient.getInstance().getAiCloudClientConfig().getSn());
|
||||
@@ -82,6 +83,9 @@ public class UploadManager {
|
||||
public void onComplete() {
|
||||
}
|
||||
});
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user