Wednesday, 1 August 2018

Activity and JobIntentService Lifecycle

I am running a JobIntentService to perform a task in background. The reason for using JobIntentService is that so that the user can minimize the screen while the operation is happening and even if the Android OS destroys the activity the JobIntentService will still keep running and if the user comes back he can be updated with the results.

But I have a case in which suppose the user himself closes the app then I want to stop the JobIntentService also.

Is there any way to notify the JobIntentService when the user himself closes the app.

Any Help will be really appreciated.

EDIT: I tries using onTaskRemoved by that is of no use aw my Test device does not call it(I am sure many other device would not be calling it either). Also The service is automatically stopped when the app is removed from the recent list but is then again restarted when the app is opened again which is what I don't want.



from Activity and JobIntentService Lifecycle

No comments:

Post a Comment