Beispiel #1
0
        /// <summary>
        /// Takes the small photo.  This thumbnail image might be good for an icon, but not a lot more.
        /// </summary>
        /// <param name="onSuccess">On success callback. Image is received as callback parameter</param>
        /// <param name="onCancel">On cancel callback.</param>
        public static void TakeSmallPhoto(Action <ImagePickResult> onSuccess, Action onCancel)
        {
            if (AGUtils.IsNotAndroidCheck())
            {
                return;
            }

            if (onSuccess == null)
            {
                throw new ArgumentNullException("onSuccess", "Success callback cannot be null");
            }

            var listener = new AGActivityUtils.OnPickPhotoListener(onSuccess, onCancel);

            AGUtils.RunOnUiThread(() => AGActivityUtils.TakePhotoSmall(listener));
        }
Beispiel #2
0
        /// <summary>
        /// Required permissions:
        ///     <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
        ///
        /// Launches the camera app to take a photo and returns resulting Texture2D in callback. The photo is also saved to the device gallery.
        ///
        /// IMPORTANT! : You don't need any permissions to use this method. It works using Android intent.
        /// </summary>
        /// <param name="onSuccess">On success callback. Image is received as callback parameter</param>
        /// <param name="onCancel">On cancel callback.</param>
        /// <param name="maxSize">Max image size. If provided image will be downscaled.</param>
        /// <param name="albumName">Album where photo will be stored.</param>
        public static void TakePhoto(Action <ImagePickResult> onSuccess, Action onCancel,
                                     ImageResultSize maxSize = ImageResultSize.Original,
                                     string albumName        = DefaultAlbumName)
        {
            if (AGUtils.IsNotAndroidCheck())
            {
                return;
            }

            if (onSuccess == null)
            {
                throw new ArgumentNullException("onSuccess", "Success callback cannot be null");
            }

            var listener = new AGActivityUtils.OnPickPhotoListener(onSuccess, onCancel);

            AGUtils.RunOnUiThread(() => AGActivityUtils.TakePhotoBig(listener, maxSize, albumName));
        }