Android Question HttpJob Stop Action

iwan.deejay

Member
Licensed User
Longtime User
Hello,
I'm using HttpJob and HttpUtils2Service to fetch image from a URL, and the file is quite big, so it takes time. The problem is, if the user navigate away from the activity when the HTTP job is not finished yet, it can suddenly navigate back to the activity that has unfinished HTTP job when the previous job is finished.

Is there any way to stop the job when the user navigates away from the activity?
Thanks
 

sgt

Member
Licensed User
Longtime User
Hello Erel

I am having the same issue with HttpJob taking some time to complete and the user navigating away from the activity and then the HttpJob completing taking the use back to the original activity. What are the other ways to fix this as I am loading data.

Thanks
 
Upvote 0

iwan.deejay

Member
Licensed User
Longtime User
My current solution is to stop the service (HttpUtils2Service) when navigating away from the activity, and restart the service when the activity is started. Although sometimes it crashes.
 
Upvote 0
Top