rename funcName
This commit is contained in:
@@ -185,43 +185,40 @@ public class MogoApplication extends AbsMogoApplication {
|
||||
// Log.d("TEST-SOCKET","socketTestData cityCode: " + socketTestData.getCityCode());
|
||||
// return new HttpDnsSimpleLocation(socketTestData.getCityCode(),socketTestData.getLat(),socketTestData.getLon()); //todo 对象唯一实例优化
|
||||
// });
|
||||
clientConfig.setIHttpDnsCurrentLocation(new IHttpDnsCurrentLocation() {
|
||||
@Override
|
||||
public HttpDnsSimpleLocation getCurrentLocation() {
|
||||
MogoLocation mogoLocation =
|
||||
MogoApisHandler.getInstance()
|
||||
.getApis().getMapServiceApi()
|
||||
.getSingletonLocationClient(getApp())
|
||||
.getLastKnowLocation();
|
||||
HttpDnsSimpleLocation httpDnsSimpleLocation;
|
||||
if (mogoLocation != null
|
||||
&& mogoLocation.getLatitude() != 0
|
||||
&& mogoLocation.getLongitude() != 0) {
|
||||
clientConfig.setIHttpDnsCurrentLocation(() -> {
|
||||
MogoLocation mogoLocation =
|
||||
MogoApisHandler.getInstance()
|
||||
.getApis().getMapServiceApi()
|
||||
.getSingletonLocationClient(getApp())
|
||||
.getLastKnowLocation();
|
||||
HttpDnsSimpleLocation httpDnsSimpleLocation;
|
||||
if (mogoLocation != null
|
||||
&& mogoLocation.getLatitude() != 0
|
||||
&& mogoLocation.getLongitude() != 0) {
|
||||
httpDnsSimpleLocation = new HttpDnsSimpleLocation(
|
||||
mogoLocation.getCityCode(),
|
||||
mogoLocation.getLatitude(),
|
||||
mogoLocation.getLongitude());
|
||||
Logger.i(TAG, "使用实时GPS信息:" + httpDnsSimpleLocation);
|
||||
} else {
|
||||
String ciyCode = SharedPrefsMgr.getInstance(getApp())
|
||||
.getString(SharedPrefsConstants.LOCATION_CITY_CODE);
|
||||
String latitude = SharedPrefsMgr.getInstance(getApp())
|
||||
.getString(SharedPrefsConstants.LOCATION_LATITUDE);
|
||||
String longitude = SharedPrefsMgr.getInstance(getApp())
|
||||
.getString(SharedPrefsConstants.LOCATION_LONGITUDE);
|
||||
try {
|
||||
httpDnsSimpleLocation = new HttpDnsSimpleLocation(
|
||||
mogoLocation.getCityCode(),
|
||||
mogoLocation.getLatitude(),
|
||||
mogoLocation.getLongitude());
|
||||
Logger.i(TAG, "使用实时GPS信息:" + httpDnsSimpleLocation);
|
||||
} else {
|
||||
String ciyCode = SharedPrefsMgr.getInstance(getApp())
|
||||
.getString(SharedPrefsConstants.LOCATION_CITY_CODE);
|
||||
String latitude = SharedPrefsMgr.getInstance(getApp())
|
||||
.getString(SharedPrefsConstants.LOCATION_LATITUDE);
|
||||
String longitude = SharedPrefsMgr.getInstance(getApp())
|
||||
.getString(SharedPrefsConstants.LOCATION_LONGITUDE);
|
||||
try {
|
||||
httpDnsSimpleLocation = new HttpDnsSimpleLocation(
|
||||
ciyCode,
|
||||
Double.parseDouble(latitude),
|
||||
Double.parseDouble(longitude));
|
||||
} catch (NumberFormatException e) {
|
||||
e.printStackTrace();
|
||||
httpDnsSimpleLocation = new HttpDnsSimpleLocation("010", 1, 1);
|
||||
}
|
||||
Logger.i(TAG, "使用缓存GPS信息:" + httpDnsSimpleLocation);
|
||||
ciyCode,
|
||||
Double.parseDouble(latitude),
|
||||
Double.parseDouble(longitude));
|
||||
} catch (NumberFormatException e) {
|
||||
e.printStackTrace();
|
||||
httpDnsSimpleLocation = new HttpDnsSimpleLocation("010", 1, 1);
|
||||
}
|
||||
return httpDnsSimpleLocation;
|
||||
Logger.i(TAG, "使用缓存GPS信息:" + httpDnsSimpleLocation);
|
||||
}
|
||||
return httpDnsSimpleLocation;
|
||||
});
|
||||
|
||||
// 初始化SDK,可以设置状态回调来监听
|
||||
@@ -256,7 +253,7 @@ public class MogoApplication extends AbsMogoApplication {
|
||||
}
|
||||
}
|
||||
|
||||
private void prepareSocketAndLocationServices() {
|
||||
private void startSocketService() {
|
||||
IMogoServiceApis apis = MogoApisHandler.getInstance().getApis();
|
||||
// 关闭长链服务
|
||||
apis.getSocketManagerApi(getApplicationContext()).destroy();
|
||||
@@ -267,7 +264,7 @@ public class MogoApplication extends AbsMogoApplication {
|
||||
@Override
|
||||
protected void socketTTL() {
|
||||
// 鉴权成功后开启socket长链服务
|
||||
prepareSocketAndLocationServices();
|
||||
startSocketService();
|
||||
}
|
||||
|
||||
private void initModules() {
|
||||
|
||||
Reference in New Issue
Block a user