I am assigning the tag to OkHttp Request like,
Request request = new Request.Builder()
.url(url)
.tag(requestTag)
.build();
and I can cancel that particular request by that using
public static void cancel(Object tag) {
for (Call call : getClient().dispatcher().queuedCalls()) {
if (tag.equals(call.request().tag())) call.cancel();
}
for (Call call : getClient().dispatcher().runningCalls()) {
if (tag.equals(call.request().tag())) call.cancel();
}
}
But how to assign multiple tag to request because I have to track the request and if any request has timeout then I have to cancel the related tag request
Any idea?