After I call jobFinished(mParams, false) I can see that the job is still pending because when I do getPendingJob just after I can still see the job.
When the job is finished I would like to schedule a new job, but I can't because getPendingJob say the job is still running and if I do jobScheduler.schedule then it's will stop the currently job running (don't know if it's matter)
NOTE: The main problem by cancelling the currently job running will be to have the event onStopJob(JobParameters params) to be called. and this is really problematic
this is the code of jobFinished implemented in android if it's can help someone to understand
public final void jobFinished(JobParameters params, boolean needsReschedule) {
ensureHandler();
Message m = Message.obtain(mHandler, MSG_JOB_FINISHED, params);
m.arg2 = needsReschedule ? 1 : 0;
m.sendToTarget();
}
so of course it's seam that jobFinished will simply send a message that will be processed in the looper (in next loop), so before I go out of the current loop the jobFinished will not be processed :( how can I do in such way ?