Whiz Whiz - 1 year ago 88
Android Question

Cancel all Retrofit requests at once?

I know that individual Retrofit requests can be cancelled at any time by simply calling


But I need a way to cancel all ongoing requests at once. Is it possible? I haven't found anything like it in the documentation.

Answer Source

You have to keep reference to your shared OkHttpClient.

Than when you want to cancel all requests just call:

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download