The problem is that pressing the home button erases the entire activity stack. This means that there is no way to return to that activity in which she is not even sure that this activity still exists.
If this is a progress that is interesting to the user because it is still working, you can display the notification bar icon until the progress is complete. I think you can specify a special intention to click on the notification panel and filter this intention with your activity. Thus, you will return to this activity. But you are still faced with the problem of maintaining activity and are not referring to the background thread doing the work.
If your activity leaves the stack, its completion method is called. You should not try to reuse this action later. The best way is to think about how you can save and restore the whole state of activity in the future. To restore the link to the background thread doing the work, you can subclass the application class and save the link to the current task in your subclass.
source share