The readme on GitHub says:
Driver is an interface that represents a component that can schedule,
cancel, and execute Jobs. The only bundled Driver is the
GooglePlayDriver, which relies on the scheduler built-in to Google
Play services.
So cancelling is part of the driver you are using. Inspecting the code of the driver interface there are two methods to cancel a job:
/**
* Cancels the job with the provided tag and class.
*
* @return one of the CANCEL_RESULT_ constants.
*/
@CancelResult
int cancel(@NonNull String tag);
/**
* Cancels all jobs registered with this Driver.
*
* @return one of the CANCEL_RESULT_ constants.
*/
@CancelResult
int cancelAll();
So in your case you have to call:
dispatcher.cancel("myJob");
or
dispatcher.cancelAll();
The dispatcher will call the corresponding method of the driver for you. If you want you can also call the methods directly on your driver myDriver.cancelAll()
like it is done in the sample app which comes with the GitHub project.
The chosen method will return one of the following constants:
public static final int CANCEL_RESULT_SUCCESS = 0;
public static final int CANCEL_RESULT_UNKNOWN_ERROR = 1;
public static final int CANCEL_RESULT_NO_DRIVER_AVAILABLE = 2;