|
@@ -38,7 +38,8 @@ class TimingWorker(context: Context, workerParams: WorkerParameters) :
|
38
|
38
|
}
|
39
|
39
|
|
40
|
40
|
companion object {
|
41
|
|
- private var lastTime = 0L
|
|
41
|
+ //在activity中判断,如果连续10分钟都没执行则重启任务。
|
|
42
|
+ var lastTime = 0L
|
42
|
43
|
|
43
|
44
|
//上次策略请求时间
|
44
|
45
|
private var StrategyTime = 0L
|
|
@@ -127,10 +128,10 @@ class TimingWorker(context: Context, workerParams: WorkerParameters) :
|
127
|
128
|
val instance = Calendar.getInstance()
|
128
|
129
|
instance.set(Calendar.MILLISECOND, 0)
|
129
|
130
|
val currentTime = instance.timeInMillis
|
|
131
|
+ LogShow("上次时间" + lastTime.toFormat() + "|||本次时间" + currentTime.toFormat())
|
130
|
132
|
if (lastTime == 0L) {
|
131
|
133
|
lastTime = currentTime
|
132
|
134
|
} else {
|
133
|
|
- LogShow("上次时间" + lastTime.toFormat() + "|||本次时间" + currentTime.toFormat())
|
134
|
135
|
lastTime = currentTime
|
135
|
136
|
}
|
136
|
137
|
val timeInMillis = currentTime - 1000 * 60 * 5
|