Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 58056

Using MediaPicker TakePhotoAsync relaunches main activity when returning to app. Xamarin.mobile

$
0
0

Hi
I have an application that uses the phones camera directly from the application, but sometimes (not always) when returning from the camera to the application it will relaunch the mainactivity and the app restarts. I have only tested it on Android at the moment. I am using the Xamarin.mobile component.
Any idea why this happens and any way to get around it? I have unchecked the "Do not keep activities" box in the developer options, but it acts like it is checked sometimes.

public Task<MediaFile> TakePhoto()
     {
            MediaFile file;
            var picker = new MediaPicker(Forms.Context);
            var save = new StoreCameraMediaOptions();
            return picker.TakePhotoAsync(save).ContinueWith(t =>
            {
                file = t.Result;
                return file;                                        
            }, TaskScheduler.FromCurrentSynchronizationContext());
        }

Viewing all articles
Browse latest Browse all 58056

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>