Esempio n. 1
0
 /// <summary>
 /// Open window for image pick. Work on IOS/Android
 /// </summary>
 public void UploadAvatarFromCamera()
 {
     if (NativeCamera.CheckPermission() != NativeCamera.Permission.Granted)
     {
         NativeCamera.RequestPermission();
     }
     NativeCamera.TakePicture(OnImageTaken);
 }
Esempio n. 2
0
    /// <summary>
    /// Android call contains 2 requests:
    /// Camera, Storage.
    /// </summary>
    private bool CheckPermissionOrRequestBase()
    {
        NativeCamera.Permission resultOfCheckPermission =
            NativeCamera.CheckPermission();

        DebugPrinter.Print("CheckCameraPermissionOrRequest");

        switch (resultOfCheckPermission)
        {
        case NativeCamera.Permission.Granted:

            DebugPrinter.Print("Camera Permission Granted");

            return(true);

        case NativeCamera.Permission.ShouldAsk:

            NativeCamera.Permission resultOfRequestPermission;

            do
            {
                resultOfRequestPermission =
                    NativeCamera.RequestPermission();

                DebugPrinter.Print(2);
            }while (resultOfRequestPermission
                    == NativeCamera.Permission.ShouldAsk);

            if (resultOfRequestPermission
                == NativeCamera.Permission.Granted)
            {
                DebugPrinter.Print(3.1f);

                return(true);
            }
            else
            {
                DebugPrinter.Print(3.2f);

                return(false);
            }

        case NativeCamera.Permission.Denied:

            DebugPrinter.Print(4);

            return(false);

        default:

            DebugPrinter.Print(5);

            return(false);
        }
    }
 public bool HaveCameraPermission()
 {
     return(NativeCamera.CheckPermission() == NativeCamera.Permission.Granted);
 }