/// <summary>Checks the status of <see cref="SaveMediaPermission"/>.</summary>
        /// <returns>The current status of the permission.</returns>
        public override Task <PermissionStatus> CheckStatusAsync()
        {
            EnsureDeclared();
            var auth = MediaGallery.HasOSVersion(14)
                ? PHPhotoLibrary.GetAuthorizationStatus(PHAccessLevel.AddOnly)
                : PHPhotoLibrary.AuthorizationStatus;

            return(Task.FromResult(Convert(auth)));
        }
        /// <summary>Request <see cref="SaveMediaPermission"/> from the user.</summary>
        /// <returns>The status of the permission that was requested.</returns>
        public override async Task <PermissionStatus> RequestAsync()
        {
            var status = await CheckStatusAsync();

            if (status == PermissionStatus.Granted)
            {
                return(status);
            }

            var auth = MediaGallery.HasOSVersion(14)
                ? await PHPhotoLibrary.RequestAuthorizationAsync(PHAccessLevel.AddOnly)
                : await PHPhotoLibrary.RequestAuthorizationAsync();


            return(Convert(auth));
        }
예제 #3
0
 /// <summary>This method should be used in the <see cref="Activity.OnActivityResult"/></summary>
 /// <param name="requestCode"></param> <param name="resultCode"></param> <param name="intent"></param>
 public static bool CheckCanProcessResult(int requestCode, Result resultCode, Intent intent)
 => MediaGallery.CheckCanProcessResult(requestCode, resultCode, intent);
예제 #4
0
 /// <summary>This method should be used in the <see cref="Activity.OnActivityResult"/></summary>
 /// <param name="requestCode"></param> <param name="resultCode"></param> <param name="intent"></param>
 public static void OnActivityResult(int requestCode, Result resultCode, Intent intent)
 => MediaGallery.OnActivityResult(requestCode, resultCode, intent);