Data Usage on each API request

Hi Mark,
Hope you are well.

I am working on a project where I am requesting 5 different requests on the server every 2 seconds. I would like to know how much data I am using in every request. I know about the profiler in Android Studio but it does not give me the data usage for each API request.

I search on google but could not find anything.

Please suggest any tool or reference. Here is [SO Question] I post(https://stackoverflow.com/questions/64470353/data-usage-each-api-consume)

If you are asking how you can measure this as a developer on your development machine, if you are using OkHttp (or things built atop it, such as Retrofit), you could use the OkHttp logging interceptor, Flipper, etc.

If you are asking how you can measure this at runtime for requests on user devices, and you are using OkHttp, you could write your own custom OkHttp interceptor that records this information and reports it via your preferred solution for that sort of thing (e.g., analytics).

Thanks, Mark for the quick prompt. I am using the Okhttp3 with AsyncTask and I want to measure how much data each API use for a certain duration. Could you please provide an example or link?

Sorry, but I do not know what to give you beyond what I did in my previous reply.

Ok, thank you for your help. Can you help with this question?

Sorry, but I do not understand that question. In general:

  • Use a ViewModel for holding onto in-use data, including user-modified data that you do not want to commit to a data store (database, server, etc.) yet

  • I recommend using a DialogFragment to manage your AlertDialog.

  • When asking questions on Stack Overflow, if you provide code to illustrate a problem, explain what you are expecting the code to do and what the code is actually doing instead

Ok, I will improve the question. Thank you for the suggestion.

Are you providing any rxJava materials? Can you please suggest the best place to learn rxJava?