Most of the Google Play Services remote function calls return a Task
that will be completed some time in the future. I have multiple tasks that I want to wait but no longer than a certain time out.
There is Tasks.await()
that will wait on one task with a time out, this will block the calling thread. Is there something that is available or can be created in the line of:
waitWithTimeout(2, TimeUnit.SECONDS, task1, task2) { results: List<Task> ->
// we will be here if both tasks are completed
// or when 2 seconds is up, whichever is earlier
}