修复上传位置00问题
This commit is contained in:
parent
1009561bde
commit
b29e3eaf03
@ -9,6 +9,7 @@ import android.util.Log;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.amap.api.location.AMapLocation;
|
||||
import com.google.gson.Gson;
|
||||
import com.arpa.hndahesudintocctmsdriver.bean.BaseBean;
|
||||
import com.arpa.hndahesudintocctmsdriver.request.HuoYuanRequset;
|
||||
@ -32,7 +33,7 @@ public class TrackService extends Service {
|
||||
private Context con;
|
||||
private TrackInputBean tib=new TrackInputBean();
|
||||
private LocationGDUtil l;
|
||||
private int timeSum=1000*60*3;
|
||||
private int timeSum=1000*10;
|
||||
private String snn="";
|
||||
private Gson gson=new Gson();
|
||||
private HuoYuanRequset hyr;
|
||||
@ -51,7 +52,11 @@ public class TrackService extends Service {
|
||||
}
|
||||
break;
|
||||
case LocationGDUtil.RES:
|
||||
genzong();
|
||||
if(CacheGroup.cacheList.get("getLocation")!=null){
|
||||
AMapLocation location = gson.fromJson(CacheGroup.cacheList.get("getLocation"), AMapLocation.class);
|
||||
genzong(location);
|
||||
CacheGroup.cacheList.remove("getLocation");
|
||||
}
|
||||
break;
|
||||
}
|
||||
return false;
|
||||
@ -94,13 +99,13 @@ public class TrackService extends Service {
|
||||
super.onDestroy();
|
||||
}
|
||||
|
||||
public void genzong(){
|
||||
public void genzong(AMapLocation location){
|
||||
//经度
|
||||
tib.setLatitude(l.getLatitude()+"");
|
||||
tib.setLatitude(location.getLatitude()+"");
|
||||
//纬度
|
||||
tib.setLongitude(l.getLongitude()+"");
|
||||
Log.e("经度",l.getLatitude()+"");
|
||||
Log.e("维度",l.getLongitude()+"");
|
||||
tib.setLongitude(location.getLongitude()+"");
|
||||
Log.e("经度",location.getLatitude()+"");
|
||||
Log.e("维度",location.getLongitude()+"");
|
||||
//单号
|
||||
tib.setShippingNoteNumber(snn);
|
||||
hyr.trackTracking(tib);
|
||||
|
@ -8,7 +8,9 @@ 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.arpa.hndahesudintocctmsdriver.util.cache.CacheGroup;
|
||||
import com.arpa.hndahesudintocctmsdriver.util.msg.MsgUtil;
|
||||
import com.google.gson.Gson;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
@ -74,6 +76,7 @@ public class LocationGDUtil {
|
||||
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
Date date = new Date(aMapLocation.getTime());
|
||||
df.format(date);
|
||||
CacheGroup.cacheList.put("getLocation",new Gson().toJson(aMapLocation));
|
||||
MsgUtil.addHdMsgWat(hd,RES);
|
||||
if (mLocationClient!=null) {
|
||||
mLocationClient.onDestroy();
|
||||
|
Loading…
Reference in New Issue
Block a user