googlearchive/android-JobScheduler

The 'onStartJob' method return a wrong result

Leaking opened this issue · 1 comments

In this sample, there are lines of code as below

    @Override
    public boolean onStartJob(JobParameters params) {
        // We don't do any real 'work' in this sample app. All we'll
        // do is track which jobs have landed on our service, and
        // update the UI accordingly.
        jobParamsMap.add(params);
        if (mActivity != null) {
            mActivity.onReceivedStartJob(params);
        }
        Log.i(TAG, "on start job: " + params.getJobId());
        return true;
    }

and return 'true' or return 'false' is based on the below words

True if your service needs to process the work (on a separate thread). False if
there's no more work to be done for this job.

In the 'onStartJob' you return 'true' and the sample does not process any time-wasted work, so I think you should return false here.

It's been revamped recently and now it returns true for a reason.