googlearchive / firebase-jobdispatcher-android

DEPRECATED please see the README.md below for details.
Apache License 2.0
1.79k stars 209 forks source link

onStartJob return true/false #242

Closed eladlavi closed 4 years ago

eladlavi commented 6 years ago

Because job runs on main thread, in order to download content from server, a Thread must be created. But then, what is the meaning of returning true or false in onStartJon? If we must return a boolean immediately, and the Thread is still running (which is always the case) then do we return false or true? I think the design was suppose to be that the Thread notifies the JobService of completion.

recheej commented 6 years ago

If you return false from onStartJob, the job will be scheduled (or may be immediately?) to be destroyed. If you return true, you are telling the system that your job still has work to do (on another thread hopefully, like you suggested). When your job is finished on the other thread, it's your responsibility to call jobFinished() for the job that was passed into onStartJob. It's your job to figure out how you call that method, but it's a requirement. Does that make sense?

HimanshuNarang commented 6 years ago

Whenever I am calling jobFinished() from background thread or returning false from onStartJob, OnStop never get called.

samtstern commented 4 years ago

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.