You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Yigit Boyar edited this page Oct 17, 2016
·
5 revisions
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.
New Package
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.
Removed / changed APIs
Job Id from Long -> String
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.
Removed deprecated methods
Job#onCancel
Job#onCancel has been replaced with Job#onCancel(@CancelReason int, Throwable).
boolean Job#shouldReRunOnThrowable
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.
Constructor
JobManager(Context, Configuration) constructor has been removed since Configuration already requires a context. Now, there is only 1 constructor and it receives a Configuration.
JobScheduler and GcmNetworkManager Integration
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
CustomLogger
A new log method CustomLogger#v(String text, Object... args) has been added to decrease the noise in JobQueue debug logs.