diff --git a/.gradle/5.6.4/executionHistory/executionHistory.bin b/.gradle/5.6.4/executionHistory/executionHistory.bin
index feb11e5..2c76f8c 100644
Binary files a/.gradle/5.6.4/executionHistory/executionHistory.bin and b/.gradle/5.6.4/executionHistory/executionHistory.bin differ
diff --git a/.gradle/5.6.4/executionHistory/executionHistory.lock b/.gradle/5.6.4/executionHistory/executionHistory.lock
index 8cbee94..c83594c 100644
Binary files a/.gradle/5.6.4/executionHistory/executionHistory.lock and b/.gradle/5.6.4/executionHistory/executionHistory.lock differ
diff --git a/.gradle/5.6.4/fileHashes/fileHashes.bin b/.gradle/5.6.4/fileHashes/fileHashes.bin
index 188ce20..cc82d55 100644
Binary files a/.gradle/5.6.4/fileHashes/fileHashes.bin and b/.gradle/5.6.4/fileHashes/fileHashes.bin differ
diff --git a/.gradle/5.6.4/fileHashes/fileHashes.lock b/.gradle/5.6.4/fileHashes/fileHashes.lock
index ef32a28..fb926a4 100644
Binary files a/.gradle/5.6.4/fileHashes/fileHashes.lock and b/.gradle/5.6.4/fileHashes/fileHashes.lock differ
diff --git a/.gradle/5.6.4/fileHashes/resourceHashesCache.bin b/.gradle/5.6.4/fileHashes/resourceHashesCache.bin
index b809d08..085651c 100644
Binary files a/.gradle/5.6.4/fileHashes/resourceHashesCache.bin and b/.gradle/5.6.4/fileHashes/resourceHashesCache.bin differ
diff --git a/.gradle/5.6.4/javaCompile/classAnalysis.bin b/.gradle/5.6.4/javaCompile/classAnalysis.bin
index e825db5..a6bdf08 100644
Binary files a/.gradle/5.6.4/javaCompile/classAnalysis.bin and b/.gradle/5.6.4/javaCompile/classAnalysis.bin differ
diff --git a/.gradle/5.6.4/javaCompile/jarAnalysis.bin b/.gradle/5.6.4/javaCompile/jarAnalysis.bin
index 416c859..a1b4329 100644
Binary files a/.gradle/5.6.4/javaCompile/jarAnalysis.bin and b/.gradle/5.6.4/javaCompile/jarAnalysis.bin differ
diff --git a/.gradle/5.6.4/javaCompile/javaCompile.lock b/.gradle/5.6.4/javaCompile/javaCompile.lock
index 85f7e02..5c6d2ad 100644
Binary files a/.gradle/5.6.4/javaCompile/javaCompile.lock and b/.gradle/5.6.4/javaCompile/javaCompile.lock differ
diff --git a/.gradle/5.6.4/javaCompile/taskHistory.bin b/.gradle/5.6.4/javaCompile/taskHistory.bin
index 97131a8..5aed186 100644
Binary files a/.gradle/5.6.4/javaCompile/taskHistory.bin and b/.gradle/5.6.4/javaCompile/taskHistory.bin differ
diff --git a/.gradle/buildOutputCleanup/buildOutputCleanup.lock b/.gradle/buildOutputCleanup/buildOutputCleanup.lock
index b7bc006..39b9566 100644
Binary files a/.gradle/buildOutputCleanup/buildOutputCleanup.lock and b/.gradle/buildOutputCleanup/buildOutputCleanup.lock differ
diff --git a/.idea/compiler.xml b/.idea/compiler.xml
index 61a9130..fb7f4a8 100644
--- a/.idea/compiler.xml
+++ b/.idea/compiler.xml
@@ -1,6 +1,6 @@
-
+
\ No newline at end of file
diff --git a/.idea/misc.xml b/.idea/misc.xml
index 87da9c4..bc01c18 100644
--- a/.idea/misc.xml
+++ b/.idea/misc.xml
@@ -9,7 +9,7 @@
-
+
diff --git a/app/build.gradle b/app/build.gradle
index 889db35..75ddc44 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -60,6 +60,7 @@ android {
26.3.9.96 播放时长为广告素材的播放时长
26.3.9.98 记录taxiApp当天的运行时间
26.3.9.99 优化日志上传,改为一天只传一次昨天的播放记录。
+ 优化定点广告频繁切换会出现黑屏问题
**/
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
diff --git a/app/src/main/java/cn/trans88/taxiappkotlin/Configurations.java b/app/src/main/java/cn/trans88/taxiappkotlin/Configurations.java
index bea5694..4db2404 100644
--- a/app/src/main/java/cn/trans88/taxiappkotlin/Configurations.java
+++ b/app/src/main/java/cn/trans88/taxiappkotlin/Configurations.java
@@ -418,6 +418,18 @@ public class Configurations {
context.getSharedPreferences("config", Context.MODE_PRIVATE).edit().putLong("firstRunTime", runTime).apply();
}
+ /**
+ * 日志概要上传的周期,默认一天传一次,单位分钟
+ * @return
+ */
+ public int logInterval(){
+ return context.getSharedPreferences("config", Context.MODE_PRIVATE).getInt("logInterval", 0);
+ }
+
+ public void logIntervalSave(int x){
+ context.getSharedPreferences("config", Context.MODE_PRIVATE).edit().putInt("screenSizeX", x).apply();
+ }
+
}
diff --git a/app/src/main/java/cn/trans88/taxiappkotlin/TaxiApp.kt b/app/src/main/java/cn/trans88/taxiappkotlin/TaxiApp.kt
index dba1b16..fa76df5 100644
--- a/app/src/main/java/cn/trans88/taxiappkotlin/TaxiApp.kt
+++ b/app/src/main/java/cn/trans88/taxiappkotlin/TaxiApp.kt
@@ -68,6 +68,8 @@ class TaxiApp:Application() {
var gpsTimer: Timer? = null
//播放日志定时器
var playerLogTimer: Timer? = null
+ //播放日志摘要定时器
+ var playerLogSummaryTimer: Timer? = null
var testCount = 0
val TAG = "TaxiApp"
diff --git a/app/src/main/java/cn/trans88/taxiappkotlin/logic/model/LogInterval.java b/app/src/main/java/cn/trans88/taxiappkotlin/logic/model/LogInterval.java
new file mode 100644
index 0000000..6e11b6d
--- /dev/null
+++ b/app/src/main/java/cn/trans88/taxiappkotlin/logic/model/LogInterval.java
@@ -0,0 +1,37 @@
+package cn.trans88.taxiappkotlin.logic.model;
+
+/**
+ * @Author: LJH
+ * @Time: 2023/12/13
+ * @description:
+ */
+public class LogInterval {
+
+ private String id;
+ private String task_id;
+ private int interval;
+
+ public String getId() {
+ return id;
+ }
+
+ public void setId(String id) {
+ this.id = id;
+ }
+
+ public String getTask_id() {
+ return task_id;
+ }
+
+ public void setTask_id(String task_id) {
+ this.task_id = task_id;
+ }
+
+ public int getInterval() {
+ return interval;
+ }
+
+ public void setInterval(int interval) {
+ this.interval = interval;
+ }
+}
diff --git a/app/src/main/java/cn/trans88/taxiappkotlin/logic/model/LogIntervalResponse.java b/app/src/main/java/cn/trans88/taxiappkotlin/logic/model/LogIntervalResponse.java
new file mode 100644
index 0000000..3b8e0a6
--- /dev/null
+++ b/app/src/main/java/cn/trans88/taxiappkotlin/logic/model/LogIntervalResponse.java
@@ -0,0 +1,19 @@
+package cn.trans88.taxiappkotlin.logic.model;
+
+/**
+ * @Author: LJH
+ * @Time: 2023/12/13
+ * @description:
+ */
+public class LogIntervalResponse extends SanleResponse{
+
+ private int interval;
+
+ public int getInterval() {
+ return interval;
+ }
+
+ public void setInterval(int interval) {
+ this.interval = interval;
+ }
+}
diff --git a/app/src/main/java/cn/trans88/taxiappkotlin/logic/network/ConnManger.kt b/app/src/main/java/cn/trans88/taxiappkotlin/logic/network/ConnManger.kt
index 970eacc..2132145 100644
--- a/app/src/main/java/cn/trans88/taxiappkotlin/logic/network/ConnManger.kt
+++ b/app/src/main/java/cn/trans88/taxiappkotlin/logic/network/ConnManger.kt
@@ -730,6 +730,7 @@ object ConnManger {
it.cancel()
it.purge()
}
+ logsSummaryTimer = null
logsSummaryTimer = Timer()
logsSummaryTimer?.schedule(object :TimerTask(){
override fun run() {
@@ -750,6 +751,7 @@ object ConnManger {
it.cancel()
it.purge()
}
+ logsSummaryTimer = null
logsSummaryTimer = Timer()
logsSummaryTimer?.schedule(object :TimerTask(){
override fun run() {
@@ -784,7 +786,7 @@ object ConnManger {
logsGroup.keys.forEach {
val adId = it
logsGroup.get(it)?.let { playLoggers ->
- val beginPlayTime = playLoggers.map { it.begin_play_ts }.min() ?: 0L
+ val beginPlayTime = playLoggers.map { it.begin_play_ts }.filter { it > 1702192270 }.min() ?: 0L
val endPlayTime = playLoggers.map { it.end_play_ts }.max() ?: 0L
val playNums = playLoggers.size
val playLogger = playLoggers.get(0)
@@ -890,6 +892,28 @@ object ConnManger {
}
}
+ /**
+ * 定时发送播放日志摘要
+ */
+ fun sendLogSummaryByInterval(interval:Int) {
+ taxiApp.playerLogSummaryTimer?.let {
+ it.cancel()
+ it.purge()
+ }
+ //if (Settings.loggerSwitch) {
+ taxiApp.playerLogSummaryTimer = Timer()
+ taxiApp.playerLogSummaryTimer?.schedule(object :TimerTask(){
+ override fun run() {
+ val playLoggers = DaoUtil.getPlayLoggers()
+ "定时上传日志摘要,playLoggers size: ${playLoggers.size}".logd()
+ val requestJson = getLogSummaryJson(playLoggers)
+ if (requestJson.isNotEmpty() && logsSummaryTimer == null){
+ sendLogsSummaryToWeb(requestJson)
+ }
+ }
+ },interval*60*1000L,interval*60*1000L)
+ }
+
/**
* 发送运行日志
*/
diff --git a/app/src/main/java/cn/trans88/taxiappkotlin/logic/network/ProcessingCommands.kt b/app/src/main/java/cn/trans88/taxiappkotlin/logic/network/ProcessingCommands.kt
index 081dcc4..a06f2d3 100644
--- a/app/src/main/java/cn/trans88/taxiappkotlin/logic/network/ProcessingCommands.kt
+++ b/app/src/main/java/cn/trans88/taxiappkotlin/logic/network/ProcessingCommands.kt
@@ -84,6 +84,9 @@ object ProcessingCommands {
"update_gps_log_switch" -> gpsSwitch(task,baseTask.type)
//获取播放日志开关状态
"get_player_log_state" -> getLoggerSwitch(task,baseTask.type)
+ //设置日志上传间隔
+ "set_log_interval" -> setLogInterval(task,baseTask.type)
+ "get_log_interval" -> getLogInterval(task,baseTask.type)
//获取gps日志开关状态
"get_gps_state" -> getGpsSwitch(task,baseTask.type)
"get_today_runtime" -> getTodayRuntime(task,baseTask.type)
@@ -176,6 +179,26 @@ object ProcessingCommands {
sanleResponse.turn_on = turn_on
val response = gson.toJson(sanleResponse)
send(response)
+
+ //测试日志上传
+ ConnManger.sendLogsSummary()
+ }
+
+ /**
+ * 获取日志上传间隔
+ */
+ private fun getLogInterval(task: String, type: String) {
+ val baseResponse = gson.fromJson(task)
+ val intervalResponse = LogIntervalResponse()
+ val interval = Configurations.config(TaxiApp.instance()).logInterval()
+ "getLogInterval-->日志上传间隔:$interval".logd()
+
+ intervalResponse.type = type
+ intervalResponse.id = baseResponse.id
+ intervalResponse.task_id = baseResponse.task_id
+ intervalResponse.interval = interval
+ val response = gson.toJson(intervalResponse)
+ send(response)
}
/**
@@ -195,24 +218,24 @@ object ProcessingCommands {
send(response)
//debug
- val lat2 = 22.665534200203726
- val lon2 = 113.91975187778473
- val lat3 = 23.665534200203726
- val lon3 = 114.91975187778473
- var isRun = true
- Timer().schedule(object :TimerTask(){
- override fun run() {
- if (isRun){
- "进圈".loge()
- taxiApp.activity?.getViewModel()?.onLocationChanged(lon2,lat2,2.0f,66.0f,1)
- isRun = false
- } else {
- "出圈".loge()
- taxiApp.activity?.getViewModel()?.onLocationChanged(lon3,lat3,2.0f,66.0f,1)
- isRun = true
- }
- }
- },0,3000L)
+// val lat2 = 22.665534200203726
+// val lon2 = 113.91975187778473
+// val lat3 = 23.665534200203726
+// val lon3 = 114.91975187778473
+// var isRun = true
+// Timer().schedule(object :TimerTask(){
+// override fun run() {
+// if (isRun){
+// "进圈".loge()
+// taxiApp.activity?.getViewModel()?.onLocationChanged(lon2,lat2,2.0f,66.0f,1)
+// isRun = false
+// } else {
+// "出圈".loge()
+// taxiApp.activity?.getViewModel()?.onLocationChanged(lon3,lat3,2.0f,66.0f,1)
+// isRun = true
+// }
+// }
+// },0,3000L)
}
/**
@@ -257,6 +280,25 @@ object ProcessingCommands {
send(response)
}
+ /**
+ * 设置日志上传周期
+ */
+ private fun setLogInterval(task: String, type: String) {
+ val baseResponse = gson.fromJson(task)
+ val loggerInterval = gson.fromJson(task)
+ "设置上传日志周期:${loggerInterval.interval}".logd()
+ //edit by yzd @20211201
+ //Settings.loggerSwitch = loggerSwitch.isTurn_on
+ Configurations.config(TaxiApp.instance()).loggerSwitchSave(true)
+ if (loggerInterval.interval>0){
+ ConnManger.sendLogSummaryByInterval(loggerInterval.interval)
+ }
+
+ baseResponse.type = type
+ val response = gson.toJson(baseResponse)
+ send(response)
+ }
+
/**
* 心跳应答检测
*/
@@ -302,7 +344,7 @@ object ProcessingCommands {
orderModel.task_id = baseResponse.task_id
orderModel.id = baseResponse.id
orderModel.type = type
- orderModel.advertise_order =orderList
+ orderModel.advertise_order = orderList
val response = gson.toJson(orderModel)
@@ -385,33 +427,6 @@ object ProcessingCommands {
private fun clearAdvertiseOrder(task: String, type: String?) {
val advertiseOrder = gson.fromJson(task)
"clearAdvertiseOrder".logd()
- //日志存卡里
-// taxiApp.saveLog("收到了清空排序指令...")
- //Settings.advertiseOrder = ""
- //edit by ljh @2023/8/9/1
- //三分钟内收到两次清除排序才会清除排序,防止排序被清除
-// taxiApp.isDoubleClearOrder += 1
-// if(taxiApp.isDoubleClearOrder < 2){
-// "没有点击两次清空排序,开始计时三分钟".logd()
-// taxiApp.clearOrderTimer.schedule(object :TimerTask(){
-// override fun run() {
-// try {
-// taxiApp.isDoubleClearOrder = 0
-// "三分钟时间到,isDoubleClearOrder重置".logd()
-// } catch (e:java.lang.Exception){
-// e.printStackTrace()
-// }
-// }
-// },3*60*1000L)
-// } else {
-// "点击了两次清空排序,取消三分钟计时并清空排序".logd()
-// taxiApp.clearOrderTimer.cancel()
-// taxiApp.clearOrderTimer.purge()
-// taxiApp.clearOrderTimer = Timer()
-// Configurations.config(TaxiApp.instance()).advertiseOrderSave("")
-// taxiApp.isDoubleClearOrder = 0
-// RefreshPlayer.refresh()
-// }
//edit by ljh @2023/8/22
// taxiApp.saveLog("clearAdvertiseOrder,清除了广告排序")
@@ -427,7 +442,6 @@ object ProcessingCommands {
RefreshPlayer.refresh()
-
}
/**
diff --git a/app/src/main/java/cn/trans88/taxiappkotlin/ui/play/PlayActivity.kt b/app/src/main/java/cn/trans88/taxiappkotlin/ui/play/PlayActivity.kt
index bebd575..21c818d 100644
--- a/app/src/main/java/cn/trans88/taxiappkotlin/ui/play/PlayActivity.kt
+++ b/app/src/main/java/cn/trans88/taxiappkotlin/ui/play/PlayActivity.kt
@@ -214,6 +214,7 @@ class PlayActivity : AppCompatActivity(), NetworkCallback, BusCallback, OnScreen
configurations.logSummaryJsonStringSave("")
Thread(Runnable { clearOverdueLogger() }).start()
isSendedLog = false
+ sendLogInterval()
"startRunTime,endRunTime初始化为:$currentTime".loge()
configurations.startRunTimeSave(currentTime)
configurations.endRunTimeSave(currentTime)
@@ -223,16 +224,18 @@ class PlayActivity : AppCompatActivity(), NetworkCallback, BusCallback, OnScreen
startRuntimeTimer()
}
DayType.IS_SAME_DAY.ordinal -> {//同一天重启
- //测试日志上传
- ConnManger.sendLogsSummary()
+
isSendedLog = false
-// val logSummaryJson = configurations.logSummaryJsonString()
-// if (!logSummaryJson.isNullOrEmpty()){
-// "同一天重启,之前的日志数据没传,重新上传".loge()
-// ConnManger.sendLogsSummary()
-// } else {
-// isSendedLog = false
-// }
+ val logSummaryJson = configurations.logSummaryJsonString()
+ if (!logSummaryJson.isNullOrEmpty()){
+ "同一天重启,之前的日志数据没传,重新上传".loge()
+ ConnManger.sendLogsSummary()
+ } else {
+ isSendedLog = false
+ }
+
+ sendLogInterval()
+
//先计算上次重启前的运行时间
val lastSumTime = configurations.sumRunTime()
val lastStartRuntime = configurations.startRunTime()
@@ -258,7 +261,7 @@ class PlayActivity : AppCompatActivity(), NetworkCallback, BusCallback, OnScreen
}
DayType.IS_SECOND_DAY.ordinal -> {
ConnManger.sendLogsSummary()
-
+ sendLogInterval()
//先计算上次重启前的运行时间
val lastSumTime = configurations.sumRunTime()
val lastStartRuntime = configurations.startRunTime()
@@ -285,6 +288,7 @@ class PlayActivity : AppCompatActivity(), NetworkCallback, BusCallback, OnScreen
configurations.endRunTimeSave(currentTime)
configurations.firstRunTimeSave(currentTime)
configurations.sumRunTimeSave(0L)
+ sendLogInterval()
}
}
} else {
@@ -297,8 +301,17 @@ class PlayActivity : AppCompatActivity(), NetworkCallback, BusCallback, OnScreen
},30*1000L,30*1000L)
}
}
+ }
-
+ /**
+ * 定时传日志摘要
+ */
+ private fun sendLogInterval(){
+ val logInterval = configurations.logInterval()
+ "logInterval:$logInterval".logd()
+ if (logInterval > 0){
+ ConnManger.sendLogSummaryByInterval(logInterval)
+ }
}
/**
diff --git a/local.properties b/local.properties
index e020d37..5a03523 100644
--- a/local.properties
+++ b/local.properties
@@ -4,5 +4,5 @@
# Location of the SDK. This is only used by Gradle.
# For customization when using a Version Control System, please read the
# header note.
-#Sat Dec 02 11:15:51 GMT+08:00 2023
+#Wed Dec 13 15:22:24 GMT+08:00 2023
sdk.dir=D\:\\Android\\sdk