保活2
This commit is contained in:
parent
da9bc38e0d
commit
1ba81f4de4
@ -5,22 +5,24 @@ import android.app.Application;
|
|||||||
import android.app.PendingIntent;
|
import android.app.PendingIntent;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
|
import android.content.IntentFilter;
|
||||||
import android.content.pm.ApplicationInfo;
|
import android.content.pm.ApplicationInfo;
|
||||||
import android.content.res.Configuration;
|
import android.content.res.Configuration;
|
||||||
import android.content.res.Resources;
|
import android.content.res.Resources;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.widget.Toast;
|
|
||||||
|
|
||||||
import com.alct.mdp.MDPLocationCollectionManager;
|
import com.alct.mdp.MDPLocationCollectionManager;
|
||||||
import com.arpa.hndahesudintocctmsdriver.report.JTTProcess;
|
import com.arpa.hndahesudintocctmsdriver.report.JTTProcess;
|
||||||
import com.arpa.hndahesudintocctmsdriver.request.net.Api;
|
import com.arpa.hndahesudintocctmsdriver.request.net.Api;
|
||||||
import com.arpa.hndahesudintocctmsdriver.ui.MainActivity;
|
import com.arpa.hndahesudintocctmsdriver.ui.MainActivity;
|
||||||
|
import com.arpa.hndahesudintocctmsdriver.util.BillLocationUtils;
|
||||||
import com.dahe.mylibrary.CommonBaseLibrary;
|
import com.dahe.mylibrary.CommonBaseLibrary;
|
||||||
import com.dahe.mylibrary.utils.ToastUtils;
|
import com.dahe.mylibrary.utils.ToastUtils;
|
||||||
import com.esign.esignsdk.EsignSdk;
|
import com.esign.esignsdk.EsignSdk;
|
||||||
import com.arpa.hndahesudintocctmsdriver.util.sp.SPUtil;
|
import com.arpa.hndahesudintocctmsdriver.util.sp.SPUtil;
|
||||||
import com.gyf.cactus.Cactus;
|
import com.gyf.cactus.Cactus;
|
||||||
import com.gyf.cactus.callback.CactusBackgroundCallback;
|
import com.gyf.cactus.callback.CactusBackgroundCallback;
|
||||||
|
import com.gyf.cactus.callback.CactusCallback;
|
||||||
import com.umeng.commonsdk.UMConfigure;
|
import com.umeng.commonsdk.UMConfigure;
|
||||||
|
|
||||||
import cn.jiguang.verifysdk.api.JVerificationInterface;
|
import cn.jiguang.verifysdk.api.JVerificationInterface;
|
||||||
@ -90,8 +92,11 @@ public class App extends Application {
|
|||||||
@Override
|
@Override
|
||||||
public void onBackground(boolean b) {
|
public void onBackground(boolean b) {
|
||||||
// String s = "";
|
// String s = "";
|
||||||
// if (b)
|
if (b){
|
||||||
// s="退到后台啦" ;
|
ToastUtils.showToast(mApplication,"推到后台了");
|
||||||
|
getBillLocation();
|
||||||
|
}
|
||||||
|
|
||||||
// else
|
// else
|
||||||
// s = "跑到前台啦";
|
// s = "跑到前台啦";
|
||||||
// ToastUtils.showToast(mApplication,s);
|
// ToastUtils.showToast(mApplication,s);
|
||||||
@ -118,6 +123,10 @@ public class App extends Application {
|
|||||||
UMConfigure.init(getApplicationContext(), UMConfigure.DEVICE_TYPE_PHONE, "");
|
UMConfigure.init(getApplicationContext(), UMConfigure.DEVICE_TYPE_PHONE, "");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void getBillLocation() {
|
||||||
|
BillLocationUtils.getInstance().getBillLocation(con);
|
||||||
|
}
|
||||||
|
|
||||||
private static String getCurrentProcessName(Context context) {
|
private static String getCurrentProcessName(Context context) {
|
||||||
String currentProcessName = "";
|
String currentProcessName = "";
|
||||||
int pid = android.os.Process.myPid();
|
int pid = android.os.Process.myPid();
|
||||||
|
@ -43,12 +43,10 @@ import com.arpa.hndahesudintocctmsdriver.event.HomeEvent;
|
|||||||
import com.arpa.hndahesudintocctmsdriver.parts.StartOrderParts;
|
import com.arpa.hndahesudintocctmsdriver.parts.StartOrderParts;
|
||||||
import com.arpa.hndahesudintocctmsdriver.report.JTTProcess;
|
import com.arpa.hndahesudintocctmsdriver.report.JTTProcess;
|
||||||
import com.arpa.hndahesudintocctmsdriver.ui.news.NewActivity;
|
import com.arpa.hndahesudintocctmsdriver.ui.news.NewActivity;
|
||||||
import com.arpa.hndahesudintocctmsdriver.util.PicturlUtil;
|
|
||||||
import com.arpa.hndahesudintocctmsdriver.util.string.StringUtil;
|
import com.arpa.hndahesudintocctmsdriver.util.string.StringUtil;
|
||||||
import com.bumptech.glide.Glide;
|
import com.bumptech.glide.Glide;
|
||||||
import com.google.gson.Gson;
|
import com.google.gson.Gson;
|
||||||
import com.gyf.cactus.Cactus;
|
import com.gyf.cactus.Cactus;
|
||||||
import com.gyf.cactus.ext.CactusExtKt;
|
|
||||||
import com.hjq.xtoast.XToast;
|
import com.hjq.xtoast.XToast;
|
||||||
import com.lxj.xpopup.XPopup;
|
import com.lxj.xpopup.XPopup;
|
||||||
import com.lxj.xpopup.interfaces.OnConfirmListener;
|
import com.lxj.xpopup.interfaces.OnConfirmListener;
|
||||||
@ -96,9 +94,6 @@ import org.greenrobot.eventbus.Subscribe;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import kotlin.Unit;
|
|
||||||
import kotlin.jvm.functions.Function1;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author hlh
|
* @author hlh
|
||||||
* @version 1.0.0
|
* @version 1.0.0
|
||||||
|
@ -84,9 +84,6 @@ public class WelcomeActivity extends BaseAppCompatActivity {
|
|||||||
@Override
|
@Override
|
||||||
public void msgMethod(Message m) {
|
public void msgMethod(Message m) {
|
||||||
super.msgMethod(m);
|
super.msgMethod(m);
|
||||||
System.out.println("csdf");
|
|
||||||
System.out.println("csdf");
|
|
||||||
System.out.println("csdf");
|
|
||||||
switch (m.what) {
|
switch (m.what) {
|
||||||
case 200:
|
case 200:
|
||||||
if (CacheGroup.cacheList.get("getImage") != null) {
|
if (CacheGroup.cacheList.get("getImage") != null) {
|
||||||
|
@ -0,0 +1,112 @@
|
|||||||
|
package com.arpa.hndahesudintocctmsdriver.util;
|
||||||
|
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.os.Handler;
|
||||||
|
import android.os.Message;
|
||||||
|
import android.util.Log;
|
||||||
|
import android.view.View;
|
||||||
|
import android.widget.Toast;
|
||||||
|
|
||||||
|
import com.arpa.hndahesudintocctmsdriver.bean.JTT;
|
||||||
|
import com.arpa.hndahesudintocctmsdriver.bean.StartOrderBean;
|
||||||
|
import com.arpa.hndahesudintocctmsdriver.constant.JTTConstant;
|
||||||
|
import com.arpa.hndahesudintocctmsdriver.parts.StartOrderParts;
|
||||||
|
import com.arpa.hndahesudintocctmsdriver.report.JTTProcess;
|
||||||
|
import com.arpa.hndahesudintocctmsdriver.request.HuoYuanRequset;
|
||||||
|
import com.arpa.hndahesudintocctmsdriver.request.UserRequset;
|
||||||
|
import com.arpa.hndahesudintocctmsdriver.service.TrackService;
|
||||||
|
import com.arpa.hndahesudintocctmsdriver.ui.home.HuoYuanFragmengt;
|
||||||
|
import com.arpa.hndahesudintocctmsdriver.util.cache.CacheGroup;
|
||||||
|
import com.arpa.hndahesudintocctmsdriver.util.http.RequsetCodeConstants;
|
||||||
|
import com.arpa.hndahesudintocctmsdriver.util.sp.SPUtil;
|
||||||
|
import com.arpa.hndahesudintocctmsdriver.util.string.StringUtil;
|
||||||
|
import com.dahe.mylibrary.utils.SelectPhotoUtils5;
|
||||||
|
import com.google.gson.Gson;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ClassName BillLocationUtils
|
||||||
|
* @Author 用户
|
||||||
|
* @Date 2022/10/17 10:24
|
||||||
|
* @Description TODO
|
||||||
|
*/
|
||||||
|
public class BillLocationUtils {
|
||||||
|
|
||||||
|
private Context con;
|
||||||
|
|
||||||
|
|
||||||
|
private static class SingletonHolder {
|
||||||
|
private static final BillLocationUtils INSTANCE = new BillLocationUtils();
|
||||||
|
}
|
||||||
|
|
||||||
|
private BillLocationUtils() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public static final BillLocationUtils getInstance() {
|
||||||
|
return SingletonHolder.INSTANCE;
|
||||||
|
}
|
||||||
|
|
||||||
|
private HuoYuanRequset hyr;
|
||||||
|
private UserRequset ur;
|
||||||
|
public void getBillLocation(Context con) {
|
||||||
|
this.con = con;
|
||||||
|
hyr = new HuoYuanRequset(con, hd);
|
||||||
|
ur = new UserRequset(con, hd);
|
||||||
|
//获取执行中的运单
|
||||||
|
hyr.startOrder(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Handler hd = new Handler(msg -> {
|
||||||
|
msgMethod(msg);
|
||||||
|
return false;
|
||||||
|
});
|
||||||
|
|
||||||
|
public void msgMethod(Message m) {
|
||||||
|
switch (m.what) {
|
||||||
|
case RequsetCodeConstants.SUCCESS:
|
||||||
|
Gson gson = new Gson();
|
||||||
|
// Toast.makeText(con,RequsetCodeConstants.FEEDBACK_TEXT,Toast.LENGTH_SHORT).show();
|
||||||
|
if (CacheGroup.cacheList.get(HuoYuanFragmengt.START_ORDER) != null) {
|
||||||
|
StartOrderBean sob = gson.fromJson(CacheGroup.cacheList.get(HuoYuanFragmengt.START_ORDER), StartOrderBean.class);
|
||||||
|
if (sob.getCode() == 200) {
|
||||||
|
if (sob.getData() != null) {
|
||||||
|
SPUtil.insSP(con, JTTConstant.JTT_DATA_NAME, JTTConstant.JTT_DATA_ORDER_KEY, gson.toJson(sob));
|
||||||
|
initStart(sob);
|
||||||
|
StartOrderParts.setStartOrder(con, sob);
|
||||||
|
ur.getJtts(sob.getData().getShippingNoteNumber());
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
Toast.makeText(con, sob.getMsg(), Toast.LENGTH_SHORT).show();
|
||||||
|
}
|
||||||
|
CacheGroup.cacheList.remove(HuoYuanFragmengt.START_ORDER);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (CacheGroup.cacheList.get("jttRes") != null) {
|
||||||
|
JTT jtt = gson.fromJson(CacheGroup.cacheList.get("jttRes"), JTT.class);
|
||||||
|
if (jtt.getCode() == 200) {
|
||||||
|
SPUtil.insSP(con, "data", "jtt", CacheGroup.cacheList.get("jttRes"));
|
||||||
|
JTTProcess.auth(con);
|
||||||
|
} else {
|
||||||
|
Toast.makeText(con, StringUtil.isNull(jtt.getMsg(), "返回错误"), Toast.LENGTH_LONG).show();
|
||||||
|
}
|
||||||
|
CacheGroup.cacheList.remove("jttRes");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void initStart(StartOrderBean sob) {
|
||||||
|
if (sob.getData() != null) {
|
||||||
|
if (sob != null && sob.getData() != null && 0 < sob.getData().getWayChildren().size()) {
|
||||||
|
//order_start.setVisibility(View.VISIBLE);
|
||||||
|
SPUtil.insSP(con, "order", "ShippingNoteNumber", sob.getData().getShippingNoteNumber());
|
||||||
|
Log.e("开始轨迹上传服务", "-----");
|
||||||
|
Intent serviceIn = new Intent(con, TrackService.class);
|
||||||
|
con.startService(serviceIn);
|
||||||
|
} else {
|
||||||
|
SPUtil.insSP(con, "order", "ShippingNoteNumber", "");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user