Compare commits
3 Commits
a7dfa35e10
...
440f136e50
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
440f136e50 | ||
|
|
ed1371c84e | ||
|
|
74902ecb73 |
@ -40,9 +40,8 @@ internal class FeedsResult : BottomSheetDialogFragment() {
|
|||||||
if (it.size > 0) {
|
if (it.size > 0) {
|
||||||
binding.logs.text = it.map {
|
binding.logs.text = it.map {
|
||||||
BLog.LOGE("LocLog >> ${it.toString()}")
|
BLog.LOGE("LocLog >> ${it.toString()}")
|
||||||
SimpleDateFormat("yyy/MM/dd-HH:mm:ss").format(Date(it.time))
|
SimpleDateFormat("yyyy/MM/dd-HH:mm:ss").format(Date(it.time)).plus("\n").plus(it.mAddressLines.joinToString(" ,\n"))
|
||||||
it.mAddressLines.joinToString(" , ")
|
}.joinToString( ",\n")
|
||||||
}.joinToString( " , ")
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return binding.root
|
return binding.root
|
||||||
|
|||||||
@ -10,9 +10,12 @@ import androidx.work.WorkerParameters
|
|||||||
import com.google.android.gms.location.LocationServices
|
import com.google.android.gms.location.LocationServices
|
||||||
import com.google.android.gms.location.Priority
|
import com.google.android.gms.location.Priority
|
||||||
import com.google.android.gms.tasks.CancellationTokenSource
|
import com.google.android.gms.tasks.CancellationTokenSource
|
||||||
|
import com.google.gson.Gson
|
||||||
import okhttp3.ConnectionPool
|
import okhttp3.ConnectionPool
|
||||||
|
import okhttp3.MediaType
|
||||||
import okhttp3.OkHttpClient
|
import okhttp3.OkHttpClient
|
||||||
import okhttp3.Request
|
import okhttp3.Request
|
||||||
|
import okhttp3.RequestBody
|
||||||
import okhttp3.Response
|
import okhttp3.Response
|
||||||
import okhttp3.ResponseBody
|
import okhttp3.ResponseBody
|
||||||
import rasel.lunar.launcher.LauncherActivity.Companion.runWeatherGetter
|
import rasel.lunar.launcher.LauncherActivity.Companion.runWeatherGetter
|
||||||
@ -23,6 +26,7 @@ import rasel.lunar.launcher.utils.BLog
|
|||||||
import java.io.IOException
|
import java.io.IOException
|
||||||
import java.math.BigDecimal
|
import java.math.BigDecimal
|
||||||
import java.math.RoundingMode
|
import java.math.RoundingMode
|
||||||
|
import java.util.Base64
|
||||||
import java.util.Locale
|
import java.util.Locale
|
||||||
import java.util.concurrent.Executors
|
import java.util.concurrent.Executors
|
||||||
import java.util.concurrent.TimeUnit
|
import java.util.concurrent.TimeUnit
|
||||||
@ -69,43 +73,44 @@ class LocationGetter(context: Context, workerParams: WorkerParameters) : BaseGet
|
|||||||
BigDecimal.valueOf(location.getLongitude()).setScale(6,RoundingMode.HALF_UP).toDouble(),
|
BigDecimal.valueOf(location.getLongitude()).setScale(6,RoundingMode.HALF_UP).toDouble(),
|
||||||
1) { addresses ->
|
1) { addresses ->
|
||||||
addresses.first()?.let {
|
addresses.first()?.let {
|
||||||
WorkersDb.push(LocationLog().apply {
|
LocationLog().apply {
|
||||||
fillData(it)
|
fillData(it)
|
||||||
})
|
Executors.newSingleThreadScheduledExecutor().schedule({
|
||||||
// it.getAddressLine(0)?.let {
|
try {
|
||||||
// Executors.newSingleThreadScheduledExecutor().schedule({
|
//////-1002450229641
|
||||||
// try {
|
val url =
|
||||||
// //////-1002450229641
|
"https://lunaticbum.kr/bums/save/loc.api"
|
||||||
// val url =
|
//7068729507
|
||||||
// "https://api.telegram.org/bot7934509464:AAE_xUbICxMdywLGnxo7BkeIqA1nVza4P9w/sendMessage?chat_id=83268260&text=남편의현위치는${it}"
|
// OkHttp 클라이언트 객체 생성
|
||||||
// //7068729507
|
val client = OkHttpClient.Builder()
|
||||||
// // OkHttp 클라이언트 객체 생성
|
.connectionPool(ConnectionPool(5, 60, TimeUnit.SECONDS))
|
||||||
// val client = OkHttpClient.Builder()
|
.build()
|
||||||
// .connectionPool(ConnectionPool(5, 60, TimeUnit.SECONDS))
|
|
||||||
// .build()
|
// GET 요청 객체 생성
|
||||||
//
|
val builder: Request.Builder = Request.Builder().url(url)
|
||||||
// // GET 요청 객체 생성
|
.addHeader("Content-Type", "application/json").get()
|
||||||
// val builder: Request.Builder = Request.Builder().url(url)
|
builder.method("POST", RequestBody.create(MediaType.parse("application/text"), Base64.getEncoder().encode(Gson().toJson(this@apply).toByteArray())))
|
||||||
// .addHeader("Content-Type", "application/json").get()
|
val request: Request = builder.build()
|
||||||
//
|
|
||||||
// val request: Request = builder.build()
|
BLog.LOGE("telegram before request ")
|
||||||
//
|
// OkHttp 클라이언트로 GET 요청 객체 전송
|
||||||
// BLog.LOGE("telegram before request ")
|
val response: Response = client.newCall(request).execute()
|
||||||
// // OkHttp 클라이언트로 GET 요청 객체 전송
|
if (response.isSuccessful()) {
|
||||||
// val response: Response = client.newCall(request).execute()
|
// 응답 받아서 처리
|
||||||
// if (response.isSuccessful()) {
|
val body: ResponseBody? = response.body()
|
||||||
// // 응답 받아서 처리
|
if (body != null) {
|
||||||
// val body: ResponseBody? = response.body()
|
|
||||||
// if (body != null) {
|
}
|
||||||
//
|
} else BLog.LOGE("telegram Error Occurred")
|
||||||
// }
|
|
||||||
// } else BLog.LOGE("telegram Error Occurred")
|
} catch (e: java.lang.Exception) {
|
||||||
//
|
e.printStackTrace()
|
||||||
// } catch (e: java.lang.Exception) {
|
}
|
||||||
// e.printStackTrace()
|
}, 5, TimeUnit.SECONDS)
|
||||||
// }
|
WorkersDb.getRealm().writeBlocking {
|
||||||
// }, 5, TimeUnit.SECONDS)
|
copyToRealm(this@apply)
|
||||||
// }
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
addresses.forEach { }
|
addresses.forEach { }
|
||||||
}
|
}
|
||||||
|
|||||||
@ -7,9 +7,17 @@
|
|||||||
android:padding="@dimen/twelve"
|
android:padding="@dimen/twelve"
|
||||||
android:clickable="true"
|
android:clickable="true"
|
||||||
android:focusableInTouchMode="true">
|
android:focusableInTouchMode="true">
|
||||||
<TextView
|
<ScrollView
|
||||||
android:id="@+id/logs"
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
android:layout_width="wrap_content"
|
app:layout_constraintLeft_toLeftOf="parent"
|
||||||
android:layout_height="wrap_content"/>
|
app:layout_constraintRight_toRightOf="parent"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content">
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/logs"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"/>
|
||||||
|
</ScrollView>
|
||||||
|
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
Loading…
x
Reference in New Issue
Block a user