I'm new to android, so have some questions regarding api
calls.
Currently i use Retrofit to accomplish my api calls.
Here is example of my api call with retrofit
@POST("posts/new")
fun createPost(@Body post: Post, @Header("Authorization") token: String): Single<PostResult>
So, assume i have 10 posts and i need to call createPost
10 times (Yes, i know i can have list
input on BE side, but ... ). Best way is to iterate over posts (for/map
) and send them to the server.
But here is problem:
- How do i can track that all calls are done?
In JS i can have something like Promise.all
- could i do something
similar in android?
I thought about counting the finished vs started requests, but i think it's bit ugly isn't?