I had a problem about how to design updater for my program. Which the best order to update data from the server? (absolutely multithreading)
Thread {
Timer {
result = downloaddata(url)
}
}
or
Timer {
Thread {
result = downloaddata(url)
}
}
And who manges the timer in the second solution? Should it be again the main thread? I would suggest the first option.
In android the
Threadwill be implemented in aService.Also, think of whether you really need periodic updates. If the changes are relatively rare, then push notifications from the server might be better solution for your needs (they will greatly reduce the number of calls to the server, thus consumed resources).