修复收到gps卫星数量为0时重复刷新问题
This commit is contained in:
parent
a361a2c11c
commit
96376ed7fc
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -1,6 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="CompilerConfiguration">
|
||||
<bytecodeTargetLevel target="1.8" />
|
||||
<bytecodeTargetLevel target="11" />
|
||||
</component>
|
||||
</project>
|
|
@ -25,6 +25,9 @@
|
|||
<root url="file://$USER_HOME$/.gradle/caches/transforms-2/files-2.1/e310a8b89f2d8ba2f75dc3a1729e8b2a/jetified-debug-db-base-1.0.6/res" />
|
||||
<root url="file://$USER_HOME$/.gradle/caches/transforms-2/files-2.1/e310a8b89f2d8ba2f75dc3a1729e8b2a/jetified-debug-db-base-1.0.6/AndroidManifest.xml" />
|
||||
<root url="jar://$USER_HOME$/.gradle/caches/transforms-2/files-2.1/e310a8b89f2d8ba2f75dc3a1729e8b2a/jetified-debug-db-base-1.0.6/jars/classes.jar!/" />
|
||||
<root url="file://$USER_HOME$/.gradle/caches/transforms-2/files-2.1/66c4a999c6f6d70833d2c8f86bcf185d/jetified-debug-db-base-1.0.6/res" />
|
||||
<root url="file://$USER_HOME$/.gradle/caches/transforms-2/files-2.1/66c4a999c6f6d70833d2c8f86bcf185d/jetified-debug-db-base-1.0.6/AndroidManifest.xml" />
|
||||
<root url="jar://$USER_HOME$/.gradle/caches/transforms-2/files-2.1/66c4a999c6f6d70833d2c8f86bcf185d/jetified-debug-db-base-1.0.6/jars/classes.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC>
|
||||
<root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/com.amitshekhar.android/debug-db-base/1.0.6/43c6abb777258b8e02b7a4f4aef44f5996ddf30f/debug-db-base-1.0.6-javadoc.jar!/" />
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
<root url="jar://$USER_HOME$/.gradle/caches/transforms-2/files-2.1/083aec472dafcfc3b0c0d766cd43b137/jetified-stetho-1.5.1/annotations.zip!/" />
|
||||
<root url="jar://$USER_HOME$/.gradle/caches/transforms-2/files-2.1/887f6708c215f50988e88d72cdabde59/jetified-stetho-1.5.1/annotations.zip!/" />
|
||||
<root url="jar://$USER_HOME$/.gradle/caches/transforms-2/files-2.1/cccd8aa5fc5dd56698cef82da605b812/jetified-stetho-1.5.1/annotations.zip!/" />
|
||||
<root url="jar://$USER_HOME$/.gradle/caches/transforms-2/files-2.1/69ab993d74cceb064b535055353ca0cb/jetified-stetho-1.5.1/annotations.zip!/" />
|
||||
</ANNOTATIONS>
|
||||
<CLASSES>
|
||||
<root url="jar://$USER_HOME$/.gradle/caches/transforms-2/files-2.1/d20b09848ce936fd0a38f787548625fb/jetified-stetho-1.5.1/jars/classes.jar!/" />
|
||||
|
@ -35,6 +36,9 @@
|
|||
<root url="jar://$USER_HOME$/.gradle/caches/transforms-2/files-2.1/cccd8aa5fc5dd56698cef82da605b812/jetified-stetho-1.5.1/jars/classes.jar!/" />
|
||||
<root url="file://$USER_HOME$/.gradle/caches/transforms-2/files-2.1/cccd8aa5fc5dd56698cef82da605b812/jetified-stetho-1.5.1/AndroidManifest.xml" />
|
||||
<root url="file://$USER_HOME$/.gradle/caches/transforms-2/files-2.1/cccd8aa5fc5dd56698cef82da605b812/jetified-stetho-1.5.1/res" />
|
||||
<root url="jar://$USER_HOME$/.gradle/caches/transforms-2/files-2.1/69ab993d74cceb064b535055353ca0cb/jetified-stetho-1.5.1/jars/classes.jar!/" />
|
||||
<root url="file://$USER_HOME$/.gradle/caches/transforms-2/files-2.1/69ab993d74cceb064b535055353ca0cb/jetified-stetho-1.5.1/res" />
|
||||
<root url="file://$USER_HOME$/.gradle/caches/transforms-2/files-2.1/69ab993d74cceb064b535055353ca0cb/jetified-stetho-1.5.1/AndroidManifest.xml" />
|
||||
</CLASSES>
|
||||
<JAVADOC>
|
||||
<root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/com.facebook.stetho/stetho/1.5.1/b71856fcb682e807ccec3a276e47c94944b6c6ea/stetho-1.5.1-javadoc.jar!/" />
|
||||
|
|
|
@ -25,6 +25,9 @@
|
|||
<root url="file://$USER_HOME$/.gradle/caches/transforms-2/files-2.1/0b4a4104fa2fea365d8bad6f5dfd0a29/jetified-GreenDaoUpgradeHelper-v2.2.1/res" />
|
||||
<root url="file://$USER_HOME$/.gradle/caches/transforms-2/files-2.1/0b4a4104fa2fea365d8bad6f5dfd0a29/jetified-GreenDaoUpgradeHelper-v2.2.1/AndroidManifest.xml" />
|
||||
<root url="jar://$USER_HOME$/.gradle/caches/transforms-2/files-2.1/0b4a4104fa2fea365d8bad6f5dfd0a29/jetified-GreenDaoUpgradeHelper-v2.2.1/jars/classes.jar!/" />
|
||||
<root url="file://$USER_HOME$/.gradle/caches/transforms-2/files-2.1/1c32e92e942e346fa72f85577fbd57cb/jetified-GreenDaoUpgradeHelper-v2.2.1/res" />
|
||||
<root url="jar://$USER_HOME$/.gradle/caches/transforms-2/files-2.1/1c32e92e942e346fa72f85577fbd57cb/jetified-GreenDaoUpgradeHelper-v2.2.1/jars/classes.jar!/" />
|
||||
<root url="file://$USER_HOME$/.gradle/caches/transforms-2/files-2.1/1c32e92e942e346fa72f85577fbd57cb/jetified-GreenDaoUpgradeHelper-v2.2.1/AndroidManifest.xml" />
|
||||
</CLASSES>
|
||||
<JAVADOC>
|
||||
<root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/com.github.yuweiguocn/GreenDaoUpgradeHelper/v2.2.1/7aef2e7b4c18afb240f0e17af5d045f176d2b8ef/GreenDaoUpgradeHelper-v2.2.1-javadoc.jar!/" />
|
||||
|
|
|
@ -25,6 +25,9 @@
|
|||
<root url="file://$USER_HOME$/.gradle/caches/transforms-2/files-2.1/94dd3650c1dd350610ff6179bb68c164/jetified-logger-2.2.0/res" />
|
||||
<root url="file://$USER_HOME$/.gradle/caches/transforms-2/files-2.1/94dd3650c1dd350610ff6179bb68c164/jetified-logger-2.2.0/AndroidManifest.xml" />
|
||||
<root url="jar://$USER_HOME$/.gradle/caches/transforms-2/files-2.1/94dd3650c1dd350610ff6179bb68c164/jetified-logger-2.2.0/jars/classes.jar!/" />
|
||||
<root url="jar://$USER_HOME$/.gradle/caches/transforms-2/files-2.1/1adbba6365c42fc22a765dabaf2bf186/jetified-logger-2.2.0/jars/classes.jar!/" />
|
||||
<root url="file://$USER_HOME$/.gradle/caches/transforms-2/files-2.1/1adbba6365c42fc22a765dabaf2bf186/jetified-logger-2.2.0/res" />
|
||||
<root url="file://$USER_HOME$/.gradle/caches/transforms-2/files-2.1/1adbba6365c42fc22a765dabaf2bf186/jetified-logger-2.2.0/AndroidManifest.xml" />
|
||||
</CLASSES>
|
||||
<JAVADOC>
|
||||
<root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/com.orhanobut/logger/2.2.0/98e69754ab23f7179137d8d2a0e3eea79200d746/logger-2.2.0-javadoc.jar!/" />
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
</map>
|
||||
</option>
|
||||
</component>
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" project-jdk-name="1.8" project-jdk-type="JavaSDK">
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_11" default="true" project-jdk-name="11" project-jdk-type="JavaSDK">
|
||||
<output url="file://$PROJECT_DIR$/build/classes" />
|
||||
</component>
|
||||
<component name="ProjectType">
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -21,8 +21,8 @@ android {
|
|||
applicationId "net.sysolution.taxiapp"
|
||||
minSdkVersion 21
|
||||
targetSdkVersion 29
|
||||
versionCode 251
|
||||
versionName "3.3.3-beta26.4.0.9-release"
|
||||
versionCode 253
|
||||
versionName "3.3.3-beta26.4.1.2-release"
|
||||
|
||||
//alphaxx - 预览版本,不会对外发布,由测试人员测试,会有很多bug
|
||||
//Betaxx - 公开测试版本,会发给其他工作人员,会有较多版本
|
||||
|
@ -63,6 +63,7 @@ android {
|
|||
优化定点广告频z繁切换会出现黑屏问题
|
||||
3.3.3-beta26.4.0.6-release 优化GPS,播放日志,运行时长上报功能
|
||||
3.3.3-beta26.4.0.7-release 优化GPS上报,每次取250条数据,小于250条时等待8分钟后再次上传
|
||||
3.3.3-beta26.4.1.2-release 修复收到的GPS卫星数量为0时频繁刷新问题
|
||||
**/
|
||||
|
||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||
|
@ -146,6 +147,8 @@ dependencies {
|
|||
//网络调试数据库
|
||||
implementation 'com.amitshekhar.android:debug-db:1.0.6'
|
||||
|
||||
implementation 'com.squareup.retrofit2:retrofit:2.6.1'
|
||||
|
||||
//logger
|
||||
implementation 'com.orhanobut:logger:2.2.0'
|
||||
|
||||
|
|
|
@ -125,4 +125,6 @@ public class PlayLogger implements Serializable {
|
|||
this.latitude = latitude;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -17,6 +17,7 @@ import cn.trans88.taxiappkotlin.logic.Repository.taxiApp
|
|||
import cn.trans88.taxiappkotlin.logic.dao.DaoUtil
|
||||
import cn.trans88.taxiappkotlin.logic.model.*
|
||||
import cn.trans88.taxiappkotlin.net.EasyHttpTool
|
||||
import cn.trans88.taxiappkotlin.net.OkHttpTool
|
||||
import cn.trans88.taxiappkotlin.play.RefreshPlayer
|
||||
import cn.trans88.taxiappkotlin.ui.play.PlayActivity
|
||||
import cn.trans88.taxiappkotlin.ui.play.isSendedLog
|
||||
|
@ -502,60 +503,6 @@ object ConnManger {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 发送坐标
|
||||
*/
|
||||
fun sendLocation() {
|
||||
taxiApp.gpsTimer?.let {
|
||||
it.cancel()
|
||||
it.purge()
|
||||
}
|
||||
synchronized(ConnManger::class.java){
|
||||
//edit by yzd @20211201
|
||||
//if (Settings.gpsSwitch) {
|
||||
if (Configurations.config(TaxiApp.instance()).gpsSwitch()) {
|
||||
"gpsSwitch on".loge()
|
||||
taxiApp.gpsTimer = Timer()
|
||||
taxiApp.gpsTimer?.schedule(object : TimerTask() {
|
||||
override fun run() {
|
||||
//edit by ljh @2024/2/28
|
||||
val locations = DaoUtil.getLocations()
|
||||
if (locations.isNotEmpty()) {
|
||||
|
||||
val requestJson: String = ProcessingCommands.gson.toJson(locations)
|
||||
//edit by ljh @2023/10/12
|
||||
for (location in locations) {
|
||||
DaoUtil.getLocationDao().delete(location)
|
||||
}
|
||||
EasyHttpTool.sendGPSToServer(requestJson)
|
||||
}
|
||||
// sendLocationToWeb()
|
||||
// sendLocation()
|
||||
}
|
||||
}, 5000,10000)
|
||||
} else {
|
||||
"gpsSwitch off".loge()
|
||||
taxiApp.gpsTimer = Timer()
|
||||
taxiApp.gpsTimer?.schedule(object : TimerTask() {
|
||||
override fun run() {
|
||||
//edit by ljh @2024/2/28
|
||||
val locations = DaoUtil.getLocations()
|
||||
if (locations.isNotEmpty()) {
|
||||
|
||||
val requestJson: String = ProcessingCommands.gson.toJson(locations)
|
||||
//edit by ljh @2023/10/12
|
||||
for (location in locations) {
|
||||
DaoUtil.getLocationDao().delete(location)
|
||||
}
|
||||
EasyHttpTool.sendGPSToServer(requestJson)
|
||||
}
|
||||
// sendLocationToWeb()
|
||||
// sendLocation()
|
||||
}
|
||||
}, 5000,60 * 60 * 1000)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 启动发送坐标线程
|
||||
|
@ -575,40 +522,68 @@ object ConnManger {
|
|||
"提交GPS数据 $requestJson".logd()
|
||||
val parse = ("application/json;charset=UTF-8").toMediaTypeOrNull()
|
||||
val body = RequestBody.create(parse, requestJson)
|
||||
EasyHttp.post(Configurations.config(TaxiApp.instance()).logServiceUrl() + "postGpsLocationLog")
|
||||
.readTimeOut(80*1000) //读超时80s,单位毫秒
|
||||
.writeTimeOut(80*1000) //写超时80s,单位毫秒
|
||||
.connectTimeout(80*1000) //连接超时80s,单位毫秒
|
||||
.headers("Authorization", "Bearer ${Configurations.config(TaxiApp.instance()).appToken()}")
|
||||
.requestBody(body)
|
||||
.retryCount(5) //网络不好自动重试5次
|
||||
.retryDelay(600) //本次请求重试延迟时间600ms
|
||||
.syncRequest(true)//设置同步请求
|
||||
.execute(object : SimpleCallBack<String>(){
|
||||
override fun onError(e: ApiException?) {
|
||||
"上传GPS数据失败:${e?.message}".loge()
|
||||
try {
|
||||
Thread.sleep(3*60*1000L)
|
||||
}catch (e: Exception) {
|
||||
"${e?.message}".loge()
|
||||
e.printStackTrace()
|
||||
}
|
||||
}
|
||||
val url = Configurations.config(TaxiApp.instance()).logServiceUrl() + "postGpsLocationLog"
|
||||
|
||||
override fun onSuccess(t: String?) {
|
||||
"上传GPS数据成功 $t".loge()
|
||||
DaoUtil.getLocationDao().deleteInTx(upLocations)
|
||||
"删除GPS数据成功".logd()
|
||||
try {
|
||||
val request = Request.Builder()
|
||||
.url(url)
|
||||
.addHeader("Authorization", "Bearer ${Configurations.config(TaxiApp.instance()).appToken()}")
|
||||
.post(body)
|
||||
.build()
|
||||
val response = OkHttpTool.getInstance().client.newCall(request).execute()
|
||||
"response code:${response?.code}".logd()
|
||||
if (response.isSuccessful){
|
||||
"上传GPS日志成功 ".logd()
|
||||
DaoUtil.getLocationDao().deleteInTx(upLocations)
|
||||
"删除GPS日志成功,upLocations.size:${upLocations.size}".logd()
|
||||
|
||||
if(upLocations.size < 250) {
|
||||
Thread.sleep(8*60*1000L)
|
||||
}
|
||||
})
|
||||
if(upLocations.size<250) {
|
||||
try {
|
||||
Thread.sleep(8*60*1000L)
|
||||
} catch (e: Exception) {
|
||||
"${e?.message}".loge()
|
||||
e.printStackTrace()
|
||||
} else {
|
||||
"上传GPS日志失败".loge()
|
||||
Thread.sleep(3*60*1000L)
|
||||
}
|
||||
} catch (e: Exception) {
|
||||
"Exception:${e.message}".loge()
|
||||
Thread.sleep(3*60*1000L)
|
||||
}
|
||||
|
||||
// EasyHttp.post(url)
|
||||
// .readTimeOut(80*1000) //读超时80s,单位毫秒
|
||||
// .writeTimeOut(80*1000) //写超时80s,单位毫秒
|
||||
// .connectTimeout(80*1000) //连接超时80s,单位毫秒
|
||||
// .headers("Authorization", "Bearer ${Configurations.config(TaxiApp.instance()).appToken()}")
|
||||
// .requestBody(body)
|
||||
// .retryCount(5) //网络不好自动重试5次
|
||||
// .retryDelay(600) //本次请求重试延迟时间600ms
|
||||
// .syncRequest(true)//设置同步请求
|
||||
// .execute(object : SimpleCallBack<String>(){
|
||||
// override fun onError(e: ApiException?) {
|
||||
// "上传GPS数据失败:${e?.message}".loge()
|
||||
// try {
|
||||
// Thread.sleep(3*60*1000L)
|
||||
// }catch (e: Exception) {
|
||||
// "${e?.message}".loge()
|
||||
// e.printStackTrace()
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// override fun onSuccess(t: String?) {
|
||||
// "上传GPS数据成功 $t".loge()
|
||||
// DaoUtil.getLocationDao().deleteInTx(upLocations)
|
||||
// "删除GPS数据成功".logd()
|
||||
// }
|
||||
// })
|
||||
// if(upLocations.size<250) {
|
||||
// try {
|
||||
// Thread.sleep(8*60*1000L)
|
||||
// } catch (e: Exception) {
|
||||
// "${e?.message}".loge()
|
||||
// e.printStackTrace()
|
||||
// }
|
||||
// }
|
||||
|
||||
} else {
|
||||
"gps数据小于0条不上传,3分钟后再次查询".logd()
|
||||
try {
|
||||
|
@ -1076,14 +1051,11 @@ object ConnManger {
|
|||
val playerLogs = DaoUtil.getPlayLoggers()
|
||||
"播放日志数据数量:${playerLogs.size}".logd()
|
||||
if (playerLogs.size>10){
|
||||
|
||||
EasyHttpTool.sendPlayLogToServer()
|
||||
|
||||
} else {
|
||||
|
||||
try {
|
||||
Thread.sleep(60*1000L)
|
||||
}catch (e: Exception){
|
||||
} catch (e: Exception){
|
||||
"Exception:${e.message}".loge()
|
||||
e.printStackTrace()
|
||||
}
|
||||
|
@ -1097,7 +1069,6 @@ object ConnManger {
|
|||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 定时发送播放日志摘要
|
||||
*/
|
||||
|
|
|
@ -18,6 +18,7 @@ import okhttp3.MediaType.Companion.toMediaTypeOrNull
|
|||
import okhttp3.RequestBody
|
||||
import com.zhouyou.http.callback.SimpleCallBack
|
||||
import com.zhouyou.http.exception.ApiException
|
||||
import okhttp3.Request
|
||||
import java.util.stream.Collectors
|
||||
|
||||
|
||||
|
@ -79,8 +80,8 @@ object EasyHttpTool {
|
|||
.headers("Authorization", "Bearer ${Configurations.config(TaxiApp.instance()).appToken()}")
|
||||
.headers("Accept-Encoding", "gzip")
|
||||
.requestBody(body)
|
||||
.retryCount(5)//本次请求重试次数
|
||||
.retryDelay(600)//本次请求重试延迟时间600ms
|
||||
.retryCount(1)//本次请求重试次数
|
||||
.retryDelay(1000)//本次请求重试延迟时间1000ms
|
||||
.execute(object :SimpleCallBack<String>(){
|
||||
override fun onError(e: ApiException?) {
|
||||
"上传运行时长失败:${e?.message}".loge()
|
||||
|
@ -165,40 +166,67 @@ object EasyHttpTool {
|
|||
}
|
||||
|
||||
/**
|
||||
* 上传10条播放日志
|
||||
* 上传100条播放日志
|
||||
*/
|
||||
fun sendPlayLogToServer(){
|
||||
val tenPlayLogs = DaoUtil.getPlayLogger().queryBuilder().limit(10).build().list()
|
||||
val tenPlayLogs = DaoUtil.getPlayLogger().queryBuilder().limit(100).build().list()
|
||||
val logJson = ProcessingCommands.gson.toJson(tenPlayLogs)
|
||||
"提交日志Json $logJson".logd()
|
||||
val parse = ("application/json;charset=UTF-8").toMediaTypeOrNull()
|
||||
val body = RequestBody.create(parse, logJson)
|
||||
EasyHttp.post(Configurations.config(TaxiApp.instance()).logServiceUrl() + "postPlayerLog")
|
||||
.readTimeOut(80*1000)
|
||||
.writeTimeOut(80*1000)
|
||||
.connectTimeout(80*1000)
|
||||
.headers("Authorization", "Bearer ${Configurations.config(TaxiApp.instance()).appToken()}")
|
||||
.headers("Accept-Encoding", "gzip")
|
||||
.requestBody(body)
|
||||
.retryCount(5) //本次请求重试次数
|
||||
.retryDelay(600) //本次请求重试延迟时间600ms
|
||||
.syncRequest(true)//设置同步请求
|
||||
.execute(object :SimpleCallBack<String>(){
|
||||
override fun onError(e: ApiException?) {
|
||||
"上传日志失败:${e?.message}".loge()
|
||||
try {
|
||||
Thread.sleep(60*1000L)
|
||||
}catch (e: Exception){
|
||||
"Exception:${e.message}".loge()
|
||||
e.printStackTrace()
|
||||
}
|
||||
}
|
||||
val url = Configurations.config(TaxiApp.instance()).logServiceUrl() + "postPlayerLog"
|
||||
|
||||
try {
|
||||
val request = Request.Builder()
|
||||
.url(url)
|
||||
.addHeader("Authorization","Bearer ${Configurations.config(TaxiApp.instance()).appToken()}")
|
||||
.addHeader("Accept-Encoding","gzip")
|
||||
.post(body)
|
||||
.build()
|
||||
val response = OkHttpTool.getInstance().client.newCall(request).execute()
|
||||
"response code:${response?.code}".logd()
|
||||
"response body:${response?.body?.string().toString()}".logd()
|
||||
if (response.isSuccessful){
|
||||
"上传日志成功 ".logd()
|
||||
DaoUtil.getPlayLogger().deleteInTx(tenPlayLogs)
|
||||
"删除日志成功".logd()
|
||||
} else {
|
||||
"上传日志失败".loge()
|
||||
Thread.sleep(60*1000L)
|
||||
}
|
||||
} catch (e: Exception) {
|
||||
"Exception:${e.message}".loge()
|
||||
Thread.sleep(60*1000L)
|
||||
}
|
||||
|
||||
|
||||
// EasyHttp.post(url)
|
||||
// .readTimeOut(80*1000)
|
||||
// .writeTimeOut(80*1000)
|
||||
// .connectTimeout(80*1000)
|
||||
// .headers("Authorization", "Bearer ${Configurations.config(TaxiApp.instance()).appToken()}")
|
||||
// .headers("Accept-Encoding", "gzip")
|
||||
// .requestBody(body)
|
||||
// .retryCount(5) //本次请求重试次数
|
||||
// .retryDelay(600) //本次请求重试延迟时间600ms
|
||||
// .syncRequest(true)//设置同步请求
|
||||
// .execute(object :SimpleCallBack<String>(){
|
||||
// override fun onError(e: ApiException?) {
|
||||
// "上传日志失败:${e?.message}".loge()
|
||||
// try {
|
||||
// Thread.sleep(60*1000L)
|
||||
// } catch (e: Exception){
|
||||
// "Exception:${e.message}".loge()
|
||||
// e.printStackTrace()
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// override fun onSuccess(t: String?) {
|
||||
// "上传日志成功 $t".loge()
|
||||
// DaoUtil.getPlayLogger().deleteInTx(tenPlayLogs)
|
||||
// "删除日志成功".loge()
|
||||
// }
|
||||
// })
|
||||
|
||||
override fun onSuccess(t: String?) {
|
||||
"上传日志成功 $t".loge()
|
||||
DaoUtil.getPlayLogger().deleteInTx(tenPlayLogs)
|
||||
"删除日志成功".loge()
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
|
@ -0,0 +1,74 @@
|
|||
package cn.trans88.taxiappkotlin.net;
|
||||
|
||||
import android.util.Log;
|
||||
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.net.InetAddress;
|
||||
import java.net.UnknownHostException;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import javax.net.ssl.HostnameVerifier;
|
||||
import javax.net.ssl.SSLSession;
|
||||
|
||||
import okhttp3.Callback;
|
||||
import okhttp3.Dns;
|
||||
import okhttp3.OkHttpClient;
|
||||
import okhttp3.Request;
|
||||
import okhttp3.Response;
|
||||
|
||||
|
||||
public class OkHttpTool {
|
||||
private OkHttpClient client;
|
||||
private volatile static OkHttpTool instance;
|
||||
|
||||
public static OkHttpTool getInstance() {
|
||||
if (instance == null) {
|
||||
synchronized (OkHttpTool.class) {
|
||||
if (instance == null) {
|
||||
instance = new OkHttpTool();
|
||||
}
|
||||
}
|
||||
}
|
||||
return instance;
|
||||
}
|
||||
|
||||
private OkHttpTool() {
|
||||
client = new OkHttpClient.Builder()
|
||||
.connectTimeout(80, TimeUnit.SECONDS)
|
||||
.readTimeout(80,TimeUnit.SECONDS)
|
||||
.writeTimeout(80,TimeUnit.SECONDS)
|
||||
.build();
|
||||
}
|
||||
|
||||
/**
|
||||
* 发送异步请求
|
||||
* @param url
|
||||
* @param callback
|
||||
*/
|
||||
public void sendRequest(String url, Callback callback){
|
||||
Request request = new Request.Builder()
|
||||
.url(url).build();
|
||||
client.newCall(request).enqueue(callback);
|
||||
}
|
||||
|
||||
/**
|
||||
* 发送同步请求
|
||||
* @param url
|
||||
* @return
|
||||
* @throws IOException
|
||||
*/
|
||||
public Response sendSyncRequest(String url) throws IOException {
|
||||
Request request = new Request.Builder().url(url).build();
|
||||
return client.newCall(request).execute();
|
||||
}
|
||||
|
||||
public OkHttpClient getClient(){
|
||||
return client;
|
||||
}
|
||||
|
||||
}
|
|
@ -977,7 +977,7 @@ class PlayViewModel(val lifecycle: Lifecycle, private val fl_play: FrameLayout,
|
|||
taxiApp.regionsList.clear()
|
||||
DaoUtil.getRegion().update(region)
|
||||
}
|
||||
}else{
|
||||
} else {
|
||||
DaoUtil.getRegion().update(region)
|
||||
}
|
||||
|
||||
|
@ -1029,13 +1029,17 @@ class PlayViewModel(val lifecycle: Lifecycle, private val fl_play: FrameLayout,
|
|||
*/
|
||||
fun clearAreaAdvertise() {
|
||||
val list = getAdvertise().queryBuilder().where(Properties.BelongTo.eq(AREA.ordinal)).list()
|
||||
list?.let {
|
||||
"list对象是空的吗:${list == null}".loge()
|
||||
"list元素是0吗:${list?.size}".loge()
|
||||
//edit by ljh @2024/4/19修复收到的GPS卫星数量为0时频繁刷新问题
|
||||
if (list.isNotEmpty()){
|
||||
//edit by ljh @2023/8/11
|
||||
taxiApp.daoAds.clear()
|
||||
for (advertise in it) {
|
||||
for (advertise in list) {
|
||||
getAdvertise().delete(advertise)
|
||||
}
|
||||
try {
|
||||
"clearAreaAdvertise -> 刷新列表了".loge()
|
||||
RefreshPlayer.refresh()
|
||||
} catch (e: InterruptedException) {
|
||||
e.printStackTrace()
|
||||
|
|
|
@ -0,0 +1,87 @@
|
|||
package cn.trans88.taxiappkotlin.util;
|
||||
|
||||
import android.util.Log;
|
||||
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.net.InetAddress;
|
||||
import java.net.UnknownHostException;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import javax.net.ssl.HostnameVerifier;
|
||||
import javax.net.ssl.SSLSession;
|
||||
|
||||
import okhttp3.Callback;
|
||||
import okhttp3.Dns;
|
||||
import okhttp3.OkHttpClient;
|
||||
import okhttp3.Request;
|
||||
import okhttp3.Response;
|
||||
|
||||
|
||||
public class OkHttpTool {
|
||||
private OkHttpClient client;
|
||||
private volatile static OkHttpTool instance;
|
||||
|
||||
public static OkHttpTool getInstance() {
|
||||
if (instance == null) {
|
||||
synchronized (OkHttpTool.class) {
|
||||
if (instance == null) {
|
||||
instance = new OkHttpTool();
|
||||
}
|
||||
}
|
||||
}
|
||||
return instance;
|
||||
}
|
||||
|
||||
private OkHttpTool() {
|
||||
client = new OkHttpClient.Builder()
|
||||
.connectTimeout(80, TimeUnit.SECONDS)
|
||||
.readTimeout(80, TimeUnit.SECONDS)
|
||||
.writeTimeout(80, TimeUnit.SECONDS)
|
||||
.build();;
|
||||
}
|
||||
|
||||
/**
|
||||
* 发送异步请求
|
||||
* @param url
|
||||
* @param callback
|
||||
*/
|
||||
public void sendRequest(String url, Callback callback){
|
||||
Request request = new Request.Builder().url(url).build();
|
||||
client.newCall(request).enqueue(callback);
|
||||
}
|
||||
|
||||
/**
|
||||
* 发送同步请求
|
||||
* @param url
|
||||
* @return
|
||||
* @throws IOException
|
||||
*/
|
||||
public Response sendSyncRequest(String url) throws IOException {
|
||||
Request request = new Request.Builder().url(url).build();
|
||||
return client.newCall(request).execute();
|
||||
}
|
||||
|
||||
|
||||
|
||||
public String getVistor(String url, String token) {
|
||||
Log.i("TAG", "token:" + token);
|
||||
// Headers headers = new Headers.Builder().add("token",token).build();
|
||||
Request request = new Request.Builder().get().url(url + "?dataKey=" + token).build();
|
||||
try {
|
||||
Response response = client.newCall(request).execute();
|
||||
if (response.isSuccessful() && response.code() == 200) {
|
||||
return response.body().string();
|
||||
}
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
|
@ -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.
|
||||
#Thu Mar 21 16:48:54 GMT+08:00 2024
|
||||
#Thu Apr 18 17:50:04 GMT+08:00 2024
|
||||
sdk.dir=D\:\\Android\\sdk
|
||||
|
|
|
@ -1 +1 @@
|
|||
[{"outputType":{"type":"APK"},"apkData":{"type":"MAIN","splits":[],"versionCode":251,"versionName":"3.3.3-beta26.4.0.9-release","enabled":true,"outputFile":"TaxiApp_v3.3.3-beta26.4.0.9-release{251}.apk","fullName":"release","baseName":"release","dirName":""},"path":"TaxiApp_v3.3.3-beta26.4.0.9-release{251}.apk","properties":{}}]
|
||||
[{"outputType":{"type":"APK"},"apkData":{"type":"MAIN","splits":[],"versionCode":253,"versionName":"3.3.3-beta26.4.1.2-release","enabled":true,"outputFile":"TaxiApp_v3.3.3-beta26.4.1.2-release{253}.apk","fullName":"release","baseName":"release","dirName":""},"path":"TaxiApp_v3.3.3-beta26.4.1.2-release{253}.apk","properties":{}}]
|
Loading…
Reference in New Issue
Block a user