-
Notifications
You must be signed in to change notification settings - Fork 395
V1 to V2 migration
V2 of JobManager includes major changes and moving to v2 is not as simple as changing the gradle dependency. This WIKI is created to make this transition easier. First, checkout the v2 roadmap.
Since making the project independent, I've moved the package from com.path
to com.birbit
domain. There 150+ files changed in v2 (mostly tests), a complete new internal architecture and a major rewrite. A simple replace of com.path.android.jobqueue
to com.birbit.android.jobqueue
should be sufficient.
In V1, jobManager#addJob
used to return a long
identifier for the job. This was a terrible API because it was only unique when merged with whether job is persistent or not. Two jobs could have the same ID if one is persistent and the other one is not.
In V2, jobs have a String ID that is assigned when the job is created. This is a UUID. You can know the ID of the job even before adding it, which makes it a lot easier if you need to identify the jobs. For instance, these IDs can be checked in the JobManagerCallback class.
Job#onCancel
has been replaced with Job#onCancel(@CancelReason int, Throwable)
.
Job#shouldReRunOnThrowable
that returns a boolean
was deprecated previous and has been removed in v2. The new API allows you to return a RetryConstraint
which gives more power in terms of how the failure should be handled.
JobManager(Context, Configuration)
constructor has been removed since Configuration
already requires a context. Now, there is only 1 constructor and it receives a Configuration
.
JobManager V2 can work with other scheduler to use them to wake up the application. See the related wiki page to enable this for your application. wiki: Integration With Schedulers
A new log method CustomLogger#v(String text, Object... args)
has been added to decrease the noise in JobQueue debug logs.