MVP: Continue async http request or cancel?

问题内容:

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:

  1. User click button
  2. As result activity call method from Presenter: presenter.dowanloadFile(). This is a async http request.
  3. Show progress
  4. After 10 seconds user get success http response
  5. Presenter call method from view: view.hideProgress

OK. This case work fine. Nice.

But suppose the next case:

  1. User click button
  2. As result activity call method from Presenter: presenter.dowanloadFile(). This is a async http request.
  3. Show progress
  4. After 2 seconds user minimize application
  5. As result activity is destroy (because turn Don’t keep activities)
  6. After 3 second user return to application
  7. As result create new activity
  8. After 5 seconds user get success http response
  9. 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?

问题评论:

原文地址:

https://stackoverflow.com/questions/47756227/mvp-continue-async-http-request-or-cancel

Tags:,

添加评论