The Android developer docs show an example of how to use a ListenableWorker. However, despite having added councurrent-futures
to my project, I see now relevant Callback object as used in the docs:
@NonNull
@Override
public ListenableFuture<Result> startWork() {
return CallbackToFutureAdapter.getFuture(completer -> {
Callback callback = new Callback() {
...
}
Can anyone point me in the right direction? There doesnt seem to be a Callback
class in androidx.concurrent.callback
at all.
this is literally the only code sample I can find that uses CallbackToFutureAdapter.getFuture
at all.
downloadAsynchronously("https://www.google.com", callback)
with whatever callback that code wants and still turn it into a future so that you can wait on the completion of that download in this example. – Getz