version:1.4
update:2021-10-21 10:14:40 fix: add:增加浏览器桌面检测升级,修复重复请求
This commit is contained in:
@@ -1,12 +1,12 @@
|
||||
package com.aoleyun.sn.manager;
|
||||
|
||||
import android.content.Context;
|
||||
import android.util.Log;
|
||||
|
||||
import com.amap.api.location.AMapLocation;
|
||||
import com.amap.api.location.AMapLocationClient;
|
||||
import com.amap.api.location.AMapLocationClientOption;
|
||||
import com.amap.api.location.AMapLocationListener;
|
||||
import com.aoleyun.sn.utils.Logutils;
|
||||
import com.aoleyun.sn.utils.SPUtils;
|
||||
|
||||
public class AmapManager {
|
||||
@@ -64,8 +64,8 @@ public class AmapManager {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
//errCode等于0代表定位成功,其他的为定位失败,具体的可以参照官网定位错误码说明
|
||||
if (aMapLocation.getErrorCode() == 0) {
|
||||
Logutils.e(TAG, "onLocationChanged: " + "定位成功");
|
||||
Logutils.e(TAG, "onLocationChanged: " + aMapLocation.getAddress());
|
||||
Log.e(TAG, "onLocationChanged: " + "定位成功");
|
||||
Log.e(TAG, "onLocationChanged: " + aMapLocation.getAddress());
|
||||
sb.append(aMapLocation.getAddress()).append("\n");
|
||||
SPUtils.put(mContext, "AmapAddress", aMapLocation.getAddress());
|
||||
SPUtils.put(mContext, "longitude", aMapLocation.getLongitude());
|
||||
@@ -73,17 +73,17 @@ public class AmapManager {
|
||||
} else {
|
||||
//定位失败
|
||||
sb.append("定位失败" + "\n");
|
||||
Logutils.e(TAG, "onLocationChanged: " + "定位失败");
|
||||
Log.e(TAG, "onLocationChanged: " + "定位失败");
|
||||
SPUtils.put(mContext, "AmapError", String.valueOf(aMapLocation.getErrorInfo()));
|
||||
}
|
||||
Logutils.e(TAG, (String) SPUtils.get(mContext, "AmapAddress", "-"));
|
||||
Logutils.e(TAG, (String) SPUtils.get(mContext, "AmapError", "-"));
|
||||
Logutils.e(TAG, "amap: " + sb.toString());
|
||||
Log.e(TAG, (String) SPUtils.get(mContext, "AmapAddress", "-"));
|
||||
Log.e(TAG, (String) SPUtils.get(mContext, "AmapError", "-"));
|
||||
Log.e(TAG, "amap: " + sb.toString());
|
||||
}
|
||||
});
|
||||
//设置场景模式后最好调用一次stop,再调用start以保证场景模式生效
|
||||
locationClient.stopLocation();
|
||||
locationClient.startLocation();
|
||||
Logutils.e(TAG, "initAmap: " + "startLocation");
|
||||
Log.e(TAG, "initAmap: " + "startLocation");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user