1

I have a simple scenario where I would like to queue two jobs, Job A and Job B.

Job B must only be called once Job A has finished.

Setup

I have encapsulated the jobManager object within Application.

App.getJobManager().addJobInBackground(new JobA()); App.getJobManager().addJobInBackground(new JobB());

Job Constructor

Both jobs typically have a constructor that looks like this:

public JobA() // or JobB
{
    super(new Params(1).requireNetwork());
}
Subby
  • 5,370
  • 15
  • 70
  • 125

1 Answers1

3

You can give both of them the same groupId so that it will not run them parallel. Note that this will still run Job B even if Job A fails.

yigit
  • 37,683
  • 13
  • 72
  • 58
  • I think there's an issue about groupId if I use it with requiredNetwork param and run the job without network once network back It will not run sequentially. Can you please check this issue https://github.com/yigit/android-priority-jobqueue/issues/374 – Lester L. Aug 01 '17 at 07:56