I am working on an app which uploads a large amount of data. I want to determine the transfer rate of the upload, to show in a notification.
I am talking in the context of your app since this makes it easier to capture the real time speed of your uploaded data. You don't need any extra libraries or sdk api's.
You are presumably uploading the data in chunks to the server. So
a) You know the data size of each packet
b) You know the start time before sending the packet / before sending multiple packets
c) You know the end time of xy packets by the server response e.g. status 200
With that you have all parameters to calculate the upload speed
double uploadSpeed = packet.size / (endTime - startTime)
// time * 1000 to have it in seconds
EDIT:
Since you are using MultiPart
from OkHttp
you can monitor the amount of bytes uploaded. Tracking progress of multipart file upload using OKHTTP. You would replace packet.size
with the current uploaded amount and the endTime
would be an interval of xy seconds.