I can't find API to call get progress function when download a file by retrofit ,How can i implement this function?
Here's an OkHttp recipe showing how to do it in an interceptor: https://github.com/square/okhttp/blob/master/samples/guide/src/main/java/com/squareup/okhttp/recipes/Progress.java. If you want to do it for a single call you'd need to use ResponseBody as your response type and then immediately wrap it with the ProgressResponseBody from that code snippet before you read.
Very glad that you can reply to me, for that matter, I have the answer, thanks!
Where exactly should I wrap with the ProgressResponseBody?
After I make the call.enqueue()??
@JakeWharton Is this at all possible without an interceptor? How to get ResponseBody from a Call
@JakeWharton For Progress for RequestBody, how should writeTo() be implemented - if this is the one to modify from the recipe?
@JakeWharton Is this at all possible without an interceptor? How to get ResponseBody from a Call object before calling execute() or enqueue() ?
Most helpful comment
link updated to : https://github.com/square/okhttp/blob/master/samples/guide/src/main/java/okhttp3/recipes/Progress.java