From 9ec3be18580f7c2f4ee58e63753deb813532ddb0 Mon Sep 17 00:00:00 2001 From: yy1717 <fctom1215@outlook.com> Date: 星期一, 13 一月 2020 14:18:55 +0800 Subject: [PATCH] Merge branch 'master' of https://gitee.com/endian11/DriveJudge --- app/src/main/java/safeluck/drive/evaluation/app.java | 30 ++++++++++++++++++++++++++---- 1 files changed, 26 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/safeluck/drive/evaluation/app.java b/app/src/main/java/safeluck/drive/evaluation/app.java index b346f70..e89276f 100644 --- a/app/src/main/java/safeluck/drive/evaluation/app.java +++ b/app/src/main/java/safeluck/drive/evaluation/app.java @@ -1,11 +1,15 @@ package safeluck.drive.evaluation; import android.app.Application; +import android.os.Environment; import android.text.TextUtils; import android.widget.Toast; import androidx.annotation.NonNull; +import androidx.work.Data; +import androidx.work.OneTimeWorkRequest; +import androidx.work.WorkManager; import com.anyun.exam.lib.AYSdk; import com.anyun.exam.lib.IAYExamListener; @@ -29,6 +33,7 @@ import safeluck.drive.evaluation.DB.failitems.FailedProj; import safeluck.drive.evaluation.DB.failitems.FailedProjRepository; +import safeluck.drive.evaluation.DB.gps.GpsInfoWorker; import safeluck.drive.evaluation.DB.rtktb.RTKConfig; import safeluck.drive.evaluation.DB.rtktb.RTKWorkRepository; import safeluck.drive.evaluation.cEventCenter.CEvent; @@ -76,6 +81,7 @@ //鏁版嵁搴撴搷浣� MyLog.i(TAG, "onCreate111"); + FileUtil.createdirs(getApplicationContext()); failedProjRepository = new FailedProjRepository(this); rtkWorkRepository = new RTKWorkRepository(this); } @@ -140,12 +146,28 @@ break; case Constant.FETCH_MAP_INFO: - StringBuffer buffer =FileUtil.readAssetTxtFile(this,Constant.MAP); - AYSdk.getInstance().sendCmd(Constant.PUSH_MAP_INFO,buffer.toString()); + StringBuffer buffer =FileUtil.readTxtFileFromSD(this,Constant.MAP); + if (buffer != null){ + + AYSdk.getInstance().sendCmd(Constant.PUSH_MAP_INFO,buffer.toString()); + }else{ + MyLog.d(TAG,String.format("鍦板浘妯″瀷鏈嫹鍏%s]鐩綍涓�", Environment.getExternalStorageDirectory().getAbsolutePath()+"/"+getApplicationContext().getPackageName())); + + } break; case Constant.REQ_VECHILE_PROFILE: - StringBuffer vebuffer =FileUtil.readAssetTxtFile(this,Constant.VEHICLE); - AYSdk.getInstance().sendCmd(Constant.PUSH_VECHILE_PROFILE,vebuffer.toString()); + StringBuffer vebuffer =FileUtil.readTxtFileFromSD(this,Constant.VEHICLE); + if (vebuffer != null){ + + AYSdk.getInstance().sendCmd(Constant.PUSH_VECHILE_PROFILE,vebuffer.toString()); + }else{ + MyLog.d(TAG,String.format("杞﹁締妯″瀷妯″瀷鏈嫹鍏%s]鐩綍涓�", Environment.getExternalStorageDirectory().getAbsolutePath()+"/"+getApplicationContext().getPackageName())); + } + break; + case Constant.GPS_INFO: + Data gpsData = new Data.Builder().putString(Constant.GPS_INFO_DATA,json).build(); + OneTimeWorkRequest gpsinfoWorkRequest = new OneTimeWorkRequest.Builder(GpsInfoWorker.class).setInputData(gpsData).build(); + WorkManager.getInstance(getApplicationContext()).enqueue(gpsinfoWorkRequest); break; } -- Gitblit v1.8.0