googlearchive/firebase-jobdispatcher-android

Trigger Reason is null always

recheej opened this issue · 2 comments

I'm registering a job is triggered by several content uris like so:

        FirebaseJobDispatcher dispatcher = new FirebaseJobDispatcher(new GooglePlayDriver(context));

        List<ObservedUri> observedUris = new ArrayList<>(4);
        observedUris.add(new ObservedUri(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, ObservedUri.Flags.FLAG_NOTIFY_FOR_DESCENDANTS));
        observedUris.add(new ObservedUri(MediaStore.Images.Media.INTERNAL_CONTENT_URI, ObservedUri.Flags.FLAG_NOTIFY_FOR_DESCENDANTS));
        observedUris.add(new ObservedUri(MediaStore.Video.Media.EXTERNAL_CONTENT_URI, ObservedUri.Flags.FLAG_NOTIFY_FOR_DESCENDANTS));
        observedUris.add(new ObservedUri(MediaStore.Video.Media.INTERNAL_CONTENT_URI, ObservedUri.Flags.FLAG_NOTIFY_FOR_DESCENDANTS));
        observedUris.add(new ObservedUri(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, ObservedUri.Flags.FLAG_NOTIFY_FOR_DESCENDANTS));
        Job scanMediaJob = dispatcher.newJobBuilder()
                .setTrigger(Trigger.contentUriTrigger(observedUris))
                .setService(UploaderScanJobService.class)
                .setTag("media-scan-trigger-job")
                .build();

When I get the JobParametrs in onStartJob, I expect that I'd be able to get which one of those 4 content uris triggered the job with jobParameters.getTriggerReason(). However, for some reason, trigger reason is always set to null in your code:

https://github.com/firebase/firebase-jobdispatcher-android/blob/fc19f124d0ea4ec3505b4d9f6e6fea0a4a205685/jobdispatcher/src/main/java/com/firebase/jobdispatcher/Job.java#L81

Is there a reason for this?

May it relate to this issue
#209

In April 2019 we announced that Firebase Job Dispatcher would be deprecated today, April 7th 2020. For this reason we are going to close all open issues and archive the repository. We will also stop supporting FJD for new app installations (such as those targeting sdk versions greater than Android Q). Existing apps that rely on FJD should continue to function as usual.

While we will no longer work on FJD, we encourage you to migrate to Work Manager which is a superior tool and fully supported by the Android team.

Thank you for taking the time to try the library and provide this feedback. We sincerely appreciate your effort and we apologize for not addressing it in time.