添加资源http-dns实现
This commit is contained in:
@@ -34,7 +34,6 @@ dependencies {
|
||||
implementation rootProject.ext.dependencies.androidxconstraintlayout
|
||||
implementation rootProject.ext.dependencies.arouter
|
||||
implementation rootProject.ext.dependencies.callchatprovider
|
||||
implementation "com.mogo.httpdns:httpdns-helper:1.0.1"
|
||||
if (Boolean.valueOf(RELEASE)) {
|
||||
api rootProject.ext.dependencies.mogomap
|
||||
api rootProject.ext.dependencies.mogomapapi
|
||||
|
||||
@@ -1,64 +0,0 @@
|
||||
package com.mogo.module.common.utils;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import com.mogo.commons.network.Utils;
|
||||
import com.mogo.httpdnshelper.sdk.HttpDnsHelper;
|
||||
import com.mogo.httpdnshelper.sdk.IHttpDnsConfig;
|
||||
import com.mogo.httpdnshelper.sdk.bean.HttpDnsSimpleLocation;
|
||||
import com.mogo.map.location.MogoLocation;
|
||||
import com.mogo.module.common.MogoApisHandler;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
* MogoHttpDnsHelper包装类
|
||||
*
|
||||
* @author tongchenfei
|
||||
*/
|
||||
public class MogoHttpDnsUtil {
|
||||
private MogoHttpDnsUtil(){
|
||||
|
||||
}
|
||||
private final static MogoHttpDnsUtil INSTANCE = new MogoHttpDnsUtil();
|
||||
public static MogoHttpDnsUtil getInstance(){
|
||||
return INSTANCE;
|
||||
}
|
||||
|
||||
public void init(Context context){
|
||||
HttpDnsHelper.INSTANCE.init(context, new IHttpDnsConfig() {
|
||||
@NotNull
|
||||
@Override
|
||||
public HttpDnsSimpleLocation getCurrentLocation() {
|
||||
MogoLocation last = MogoApisHandler.getInstance().getApis().getMapServiceApi().getSingletonLocationClient(context).getLastKnowLocation();
|
||||
if(last!=null){
|
||||
return new HttpDnsSimpleLocation(last.getCityCode(), last.getLatitude(), last.getLongitude());
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean showDebugLog() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public String getSn() {
|
||||
return Utils.getSn();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public String getHttpAddress(){
|
||||
return HttpDnsHelper.INSTANCE.getHttpDnsAddress(HttpDnsHelper.HTTP_DNS_TYPE_HTTP);
|
||||
}
|
||||
|
||||
public String getWsAddress(){
|
||||
return HttpDnsHelper.INSTANCE.getHttpDnsAddress(HttpDnsHelper.HTTP_DNS_TYPE_WS);
|
||||
}
|
||||
|
||||
public void release(){
|
||||
HttpDnsHelper.INSTANCE.release();
|
||||
}
|
||||
}
|
||||
@@ -12,7 +12,6 @@ import com.mogo.map.location.IMogoLocationClient;
|
||||
import com.mogo.map.location.IMogoLocationListener;
|
||||
import com.mogo.map.location.MogoLocation;
|
||||
import com.mogo.module.common.MogoApisHandler;
|
||||
import com.mogo.module.common.utils.MogoHttpDnsUtil;
|
||||
import com.mogo.module.main.EventDispatchCenter;
|
||||
import com.mogo.module.main.cards.MogoModulesManager;
|
||||
import com.mogo.module.main.delaycheck.DelayCheckUtil;
|
||||
@@ -53,8 +52,6 @@ class MogoMainService extends Service implements IMogoLocationListener {
|
||||
// 开启延时检测
|
||||
DelayCheckUtil delayCheckUtil = new DelayCheckUtil(this);
|
||||
delayCheckUtil.waitingForCheck();
|
||||
|
||||
MogoHttpDnsUtil.getInstance().init(this);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@@ -111,6 +108,5 @@ class MogoMainService extends Service implements IMogoLocationListener {
|
||||
mLocationClient = null;
|
||||
}
|
||||
mServiceApis = null;
|
||||
MogoHttpDnsUtil.getInstance().release();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user