In my phone when minimize aplicatoin then the Android destroy activity. In Developer options I turn "Don't keep activities".
I try to implement MVP.
I have a activity with button.
Steps:
- User click button
- As result activity call method from Presenter:
presenter.dowanloadFile()
. This is a async http request. The size of file is about 10 MB. - Show progress
- After 10 seconds user get success http response
- Presenter call method from view:
view.hideProgress
OK. This case work fine. Nice.
But suppose the next case:
- User click button
- As result activity call method from Presenter:
presenter.dowanloadFile()
. This is a async http request. - Show progress
- After 2 seconds user minimize application
- As result activity is destroy (because turn Don't keep activities)
- After 3 second user return to application
- As result create new activity
- After 5 seconds user get success http response
- Presenter call method from view:
view.hideProgress
The question is:
Is I need to continue http request when user minimize application (item 4). Or I must cancel current http request. And when user again return to application I must again start new async http request?
I want the next: When user return to application and if http request success finish then to show result. If the request is not finish then continue to wait http response.