Package 

Interface NetworkRetryCoordinator


  • 
    public interface NetworkRetryCoordinator
    
                        

    Bridges task failure events to TaskQueue retry logic.

    When an HttpTask fails with a retryable error (network failure, server 5xx, HTTP 424/503, timeout, etc.), the coordinator waits for connectivity restoration (if offline) and triggers TaskQueue.retryFailedTasks. The injected RetryPolicy governs how many times and with what delay retries are attempted.

    Lifecycle:

    • Call enableRetries on app foreground to allow retry cycles.

    • Call resetSession on app background or SDK stop to cancel in-flight work and disable retries.

    • Method Detail

      • enableRetries

         abstract Unit enableRetries()

        Re-enables the coordinator after a resetSession call.

        When the app goes to background, resetSession disables the coordinator to prevent wasted work. However, tasks that were already in-flight may complete with a retryable failure after the reset. Without this guard, those late failures would start a new retry cycle on a stale state (observer stopped, policy reset). This method must be called on app foreground — after com.appsflyer.internal.network.NetworkStateObserver.start — to re-open the gate for new retry cycles.

      • onRetryableFailure

         abstract Unit onRetryableFailure()

        Signals that a retryable task failure occurred. If offline, registers a one-shot connectivity listener to retry when network returns. If online, evaluates the retry policy immediately (with backoff delay). No-op if disabled via resetSession or if the RetryPolicy has exhausted its budget.

      • resetSession

         abstract Unit resetSession()

        Cancels any in-flight retry cycle (pending timer, connectivity listener), resets the policy attempt counter, and disables the coordinator. New retry cycles are blocked until enableRetries is called.