Sobes.tech
Middle+

What is the difference between job and supervisor job in Android development?

sobes.tech AI

Answer from AI

Differences in lifecycle and behavior when an error occurs:

  • Job: Any error in a child Job causes the cancellation of the parent Job and all its child Jobs. This is the "error propagates upward" model.

  • SupervisorJob: An error in a child Job does not cause the cancellation of the parent Job. Child Jobs can be canceled individually. This is the "error does not propagate upward" model.

SupervisorJob is often used in the UI layer (for example, in ViewModel) or for parallel operations, where the failure of one task should not affect others. Job is suitable for sequential or related operations, where the failure of one part makes it impossible to continue the entire task.

What is the difference between job and supervisor job… - sobes.tech