What is the best practice to handle activity recreation when using async and await?

I have some async operations that run when the user click a button this operations take some time and a loader is shown. But, if the user rotate the device,or if the user send the app to background, the activity is destroyed. This cause the async operations to fail because the response returns to a dead activity.

My question is how can I handle this situations, can someone point me to some code or example handling this? I would really appreciate it. I been searching I found some post but no code example or solutions.

I know I can cancel the async operation and restart a new one, but I would like a solutions where the operations continues even when the activity is recreated.

All the async methods are in a PCL which a share with a IOS app, in Ios this is no problem. I would like to continue to use the same methods in the PCL for the android app.

Thanks,

Sign In or Register to comment.