android-priority-jobqueue
android-priority-jobqueue copied to clipboard
Handling onRun() in Job
halo @yigit, it's possible for handling Job `onRun'?
let's say I have two Job, it's called FirstJob
and SecondJob
. FirstJob
have the Highest priority, I want to execute SecondJob
when FirstJob
it's really done.
on onAdded
method it's good the called sequential or FirstJob
first and then SecondJob
.
on onRun
method, it will indeed be called sequential, FirstJob
first and then SecondJob
even the FirstJob
still not get the response from network service, the SecondJob
its still running and it can cause the SecondJob
will be executed first in API service and got on error.
My question, is it possible to handle jobs in OnRun
method, like the example above SecondJob
onRun
method will be called when FirstJob
OnRun
is really done, i mean get a response from the network ?
If you set a group id for the two jobs they would run sequentially. The second job would only run if the first was removed via successful run, cancellation or reaching the retry limit.
The alternative is to just perform your API service calls in one job unless you needed to run them independently at some point.