...
This commit is contained in:
parent
1b2c1f593b
commit
d6f550d4fe
@ -51,12 +51,16 @@ class LocationUpdateService : Service(), LocationListener {
|
||||
WorkersDb.getRealm()?.apply {
|
||||
LocationLog().let { loc ->
|
||||
loc.fillData(it)
|
||||
// var list = query<LocationLog>().sort("time", Sort.DESCENDING).find()
|
||||
// (list.size == 0 || (list.size > 0 && list.first().time < (System.currentTimeMillis() - (1000L * 60L * 10L)) && list.first().mLatitude )).letTrue {
|
||||
var list = query<LocationLog>().sort("time", Sort.DESCENDING).find()
|
||||
writeBlocking {
|
||||
copyToRealm(loc)
|
||||
}
|
||||
(list.size == 0 || (list.size > 0 && list.first().time < (System.currentTimeMillis() - (1000L * 60L * 5L)) )).letTrue {
|
||||
Executors.newSingleThreadScheduledExecutor().schedule({
|
||||
try {
|
||||
//////-1002450229641
|
||||
val url = PrefString.locationApi.get()
|
||||
BLog.LOGE("LocationLog ${url}")
|
||||
if (url.length > 10) {
|
||||
val client = OkHttpClient.Builder()
|
||||
.connectionPool(ConnectionPool(5, 60, TimeUnit.SECONDS))
|
||||
@ -69,7 +73,7 @@ class LocationUpdateService : Service(), LocationListener {
|
||||
"POST", RequestBody.create(
|
||||
MediaType.parse("application/text"),
|
||||
Base64.getEncoder().encode(
|
||||
Gson().toJson(this@apply).toByteArray()
|
||||
Gson().toJson(loc).toByteArray()
|
||||
)
|
||||
)
|
||||
)
|
||||
@ -90,14 +94,11 @@ class LocationUpdateService : Service(), LocationListener {
|
||||
e.printStackTrace()
|
||||
}
|
||||
}, 5, TimeUnit.SECONDS)
|
||||
// }
|
||||
writeBlocking {
|
||||
copyToRealm(loc)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
addresses.forEach { }
|
||||
// addresses.forEach { }
|
||||
}
|
||||
}
|
||||
} catch (e: IOException) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user