Collectives™ on Stack Overflow

Find centralized, trusted content and collaborate around the technologies you use most.

Learn more about Collectives

Teams

Q&A for work

Connect and share knowledge within a single location that is structured and easy to search.

Learn more about Teams Prior to Android 8.0, JobIntentService is implemented as an IntentService . While you could use stopService() to destroy an IntentService , this may not have an effect on the background thread used for onHandleIntent() (I have never tried this). CommonsWare Aug 28, 2017 at 15:15

JobIntentService is only bringing IntentService to Android 8+ that is more strict about background services. It runs like old IntentService s on devices with older versions of Android.

IntentService has never been designed to be cancelled , hence the lack of any API to cancel a JobIntentService .

Therefore, JobIntenService should only be used for work that don't need to be cancelled. Note that JobIntentService can still be used for work that can fail , and consequently, be aborted.

Work that can be cancelled should be executed in either:

  • An Activity (or its ViewModel ) for short duration work
  • A JobService (using Firebase Job Dispatcher or Job Scheduler if minSdk is 21)
  • A custom foreground service
  • Prior to Android 8.0, JobIntentService is implemented as an IntentService . IntentService does not stop or take any other requests through some intent action until its onHandleIntent method completes the previous request. stopService () won't be called until the task is finished.And it's called automatically when it is. That's a feature of IntentService But a similar question was already answered here referring to IntentServices , hope it helps.

    answered question

    also check out android developers

    Thanks for contributing an answer to Stack Overflow!

    • Please be sure to answer the question . Provide details and share your research!

    But avoid

    • Asking for help, clarification, or responding to other answers.
    • Making statements based on opinion; back them up with references or personal experience.

    To learn more, see our tips on writing great answers .