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

Can't detect back button when showing camera screen

$
0
0
public partial class TakePhotoPage
{
    private bool _firstLoading =true;~~~~~~~~~~~~
    protected override void OnAppearing()
            {
                if (_firstLoading)
                {
                    TakePicture();
                    _firstLoading = false;
                }
                if (backEvent == 1)
                {
                    base.OnAppearing();
                    DependencyService.Get<IOrientationService>().SetOrientation(DeviceOrientation.Portrait);
                }
            }

            protected override void OnDisappearing()
            {
                base.OnDisappearing();
                DependencyService.Get<IOrientationService>().SetOrientation(DeviceOrientation.Portrait);
            }

            async void TakePicture()
            {
                viewModel.IsBusy = true;
                await CrossMedia.Current.Initialize();
                viewModel.IsBusy = false;
                if (!CrossMedia.Current.IsTakePhotoSupported)
                {
                    return;
                }
                string prefix = DateTime.Today.ToString("dd-MM-yyyy");
                var file = await CrossMedia.Current.TakePhotoAsync(new Plugin.Media.Abstractions.StoreCameraMediaOptions
                {
                    SaveToAlbum = true,
                    SaveMetaData = true,
                    Directory = prefix,
                    MaxWidthHeight = 1650,
                    CompressionQuality = 75
                }); // show camera here

                if (file == null)
                {
                    return;
                }
    }
}

i try override some method to detect back button. but it's only working when click back button at TakePhotoPage, in camera screen , it's not working.
Have anything detect when click back button at camera screen ?????? I want detect to redirect to another page when click back button in camera screen(not back button of navigation bar)- Need Android & IOS Pls

Thanks All.


Viewing all articles
Browse latest Browse all 77050

Trending Articles



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