Response and Error Handling

Ignite Services Client SDK supports multiple approaches for receiving install results. This flexibility adds redundancy to ensure status events are properly captured and allows third-party applications to manage their unique business needs. A calling application may:

  • Register a broadcast receiver to receive pre-defined Ignite action string
  • Use the IIgniteServiceCallback interface

Ignite Installer Broadcast Action

Applications that intend to receive install results can register a broadcast receiver to receive status updates. The fully qualified name of the broadcast receiver should be included with calls to asynchronous APIs.

Broadcast action: com.digitalturbine.ignite.service.action.STATUS_CHANGED

Broadcast details

Install status will only be sent to the application which triggers installs. For example, both app-A and app-B register to receive the broadcast. App-A installs app-C; only app-A will receive the status updates for app-C (app-B will not receive updates for app-C).

Extras:

  • TASK_ID
  • PACKAGE_ID
  • PACKAGE_NAME
  • STATUS (see status codes below)
  • STATUS_MESSAGE
  • NONCE

STATUS codes:

  • STATUS_SUCCESS (0)
  • STATUS_FAILURE (1)
  • STATUS_FAILURE_BLOCKED (2)
  • STATUS_FAILURE_ABORTED (3)
  • STATUS_FAILURE_INVALID (4)

    Note

    if the file does not exist or is corrupted, this error code will be returned. This includes scenarios where the SHA-256 check fails.

  • STATUS_FAILURE_CONFLICT (5)
  • STATUS_FAILURE_STORAGE (6)
  • STATUS_FAILURE_INCOMPATIBLE (7)
  • STATUS_PROGRESS (8)

Ignite Service Response Callback

interface IResponseCallback {
    /**
     * Called when response is successful
     *
     * @param result result of the operation of the type [R]
     */
    fun onSuccess(result: R)

    /**
     * Called when any error occurred during communication
     *
     * @param error error description of the type [E]
     */
    fun onError(error: E)

    /**
     * Called when Ignite notifies about the task progress
     *
     * @param progress contains [Progress] provided by Ignite
     */
    fun onProgress(progress: P) {
        // Do nothing by default
    }

    /**
     * Called when Ignite started task execution
     *
     * @param taskInfo contains any task info provided by Ignite [TaskInfo]
     */
    fun onStart(taskInfo: TaskInfo) {
        // Do nothing by default
    }

    /**
     * Called when Ignite scheduled task execution
     *
     * @param taskInfo contains any task info provided by Ignite [TaskInfo]
     */
    fun onScheduled(taskInfo: TaskInfo) {
        // Do nothing by default
    }
}

Back to Top ⇧