Cant stop Firebase JobDispatcher service

前端 未结 1 713
灰色年华
灰色年华 2021-01-25 20:35

Possible Duplicate

I have created a JobDispatcher service to keep getting user location in background and post user location to server. For that i have created a Job as

相关标签:
1条回答
  • 2021-01-25 21:19

    you need to cancel job in itself by unregistering location listener and calling jobFinished() inside LocationJobService.

    As dispatcher.cancelAll() works only to cancel scheduled jobs which are yet to be run. You may use tools like Eventbus to inform service when to stop.

    Refer https://medium.com/google-developers/scheduling-jobs-like-a-pro-with-jobscheduler-286ef8510129 for more info.

    0 讨论(0)
提交回复
热议问题