I am trying to integrate android-priority-jobqueue in android but onRun is not called i dont know what i am doing wrong.
Here is my Job class
public class UpdateAttachmentJob extends Job {
long id;
String token;
private static final String GROUP = "attachment";
public static final int PRIORITY = 1;
public UpdateAttachmentJob(long id,String token) {
super(new Params(PRIORITY).requireNetwork().persist());
this.id=id;
this.token=token;
}
@Override
public void onAdded() {
}
@Override
public void onRun() throws Throwable {
AttachmentTable tableItem = QueryClass.getData(id);
new UpdateAttachmentsService().updateAttachment(id, tableItem.Name, tableItem.Description, tableItem.filePath,token ,new ApiCallBack() {
@Override
public void onSuccess(Object object) {
BaseClass baseClass = (BaseClass) object;
if (baseClass.getStatus() == Constants.status) {
QueryClass.deleteSyncTask(id);
}
}
@Override
public void onError(Object object, String message) {
}
});
}
@Override
protected void onCancel() {
}
}
Here is how i call the job
if (mjobManager==null)
mjobManager=new JobManager(context);
mjobManager.addJobInBackground(new UpdateAttachmentJob(id,token));
What am i doing wrong, how to make it work