What is the most effective method for periodically calling an API in the background?
I have application where I use TimeTask for counting timeFromLastOrderLoad.
val t: TimerTask = object : TimerTask() {
override fun run() {
timeFromLastOrderLoad += 1
if (timeFromLastOrderLoad >= reloadingPeriod) {
timeFromLastOrderLoad = 0
activity?.get()?.runOnUiThread {
getStatus()
}
}
}
}...