Retrofit: How to get downloading progress while streaming?

Created on 8 Jan 2016  路  4Comments  路  Source: square/retrofit

Hi, all:
I'm a developer access retrofit about several days.
I know you should use (@Streaming) annotation to avoid OOM while downloading a file.
At the same time you hope you could get the downloading progress, I achieve that by using the ProgressResponseBody.
The problem is when you use (@Streaming), you will not Buffer the entire body and thus my question is
How to get the downloading progress when you use (@Streaming) at the same time.

Best Wishes.

All 4 comments

You can see a full working example at https://github.com/square/okhttp/blob/master/samples/guide/src/main/java/okhttp3/recipes/Progress.java. Basically: count the bytes by wrapping the Source (or InputStream).

How to ensure that only initialize a OkHttpClient object?

can explain it ?

How to ensure that only initialize a OkHttpClient object?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jpshelley picture jpshelley  路  4Comments

pankai picture pankai  路  3Comments

zheangrybear picture zheangrybear  路  3Comments

starktonys picture starktonys  路  3Comments

ramonmoraes8080 picture ramonmoraes8080  路  3Comments