I'd like to send async requests that never return a response (logging, business events, etc). Is this supported by Retrofit?
Use an empty Callback:
public final class Callbacks {
private static final Callback<Object> EMPTY = new Callback<Object> {
@Override public void success(Object value, Response response) {}
@Override public void failure(RetrofitError error) {}
}
@SuppressWarnings("unchecked")
public static <T> Callback<T> empty() {
return (Callback<T>) EMPTY;
}
}
And then in your code:
apiService.someEndpoint(Callbacks.empty());
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With