Essentially, using Task
across app lifecycle boundaries is asking for trouble. When the camera Activity
starts on Android, you are actually starting a completely new app. Your app is no longer running in the foreground, so Android is completely within its rights to kill off your app and just restart it when the camera returns. If this happens, your Task
instance has been destroyed and so any await
s or ContinueWith
s you have will never execute. It's not a Task
/Android issue, it was simply a design flaw in Xamarin.Mobile.
As a result, the magic API was deprecated in favor of one that utilizes OnActivityResult
, as it is the only way to properly handle this situation. If you notice, the new API GetMediaFileExtraAsync
still returns a Task<MediaFile>
.
(Source: I wrote Xamarin.Mobile).