title: Compulsary requirement to take and store users photo using Xam.Plugin.Media
body: <p>I have a PCL type app and I'm using the <code>Xam.Plugin.Media</code> plugin. I need it to ensure a user submits a photo from the camera before they can continue. </p>
  
  <p>To do this I show the camera page from a button click event and I want to ensure that in case the user cancels out of this that the app launches the camera again, this would repeat until a photograph is stored.</p>
  
  <p>Currenty my app falls in the <code>onActivityResumed</code> method of the <code>MainApplication</code> file when the user cancels out of the camera</p>
  
  <p>Attached photo of my code, <a href="https://i.stack.imgur.com/UvzQE.png" rel="nofollow noreferrer">My code</a>.</p>
  
  <pre><code> private async void TakePicture()
          {
              await CrossMedia.Current.Initialize();
  
              if (!CrossMedia.Current.IsCameraAvailable || !CrossMedia.Current.IsTakePhotoSupported)
              {
                  await App.Current.MainPage.DisplayAlert("No Camera", ":( No camera available.", "Aceptar");
              }
  
  
  
              file = await CrossMedia.Current.TakePhotoAsync(new Plugin.Media.Abstractions.StoreCameraMediaOptions
              {
                  Directory = "Sample",
                  Name = "test.jpg",
                  PhotoSize = PhotoSize.Small,
              });
  
              //IsRunning = true;
  
  
              if (file != null)
              {
                  ImageSource = ImageSource.FromStream(() =&gt;
                  {
                      var stream = file.GetStream();
                      return stream;
                  });
              }
  
              IsRunning = false;
          }
  </code></pre>