public void SaveImage(Texture2D image, string name, string androidAlbumName, ImageFormat format = ImageFormat.JPG, Action <string> callback = null)
        {
            if (callback == null)
            {
                Debug.LogError(NullCallbackMessage);
                return;
            }

            if (image == null)
            {
                callback(NullImageMessage);
                return;
            }

            if (nativeGallery == null)
            {
                callback(NullNativeGalleryMessage);
                return;
            }

            if (String.IsNullOrEmpty(androidAlbumName))
            {
                androidAlbumName = Application.productName;
            }
            nativeGallery.Call(NativeSaveImageName, TextureUtilities.Encode(image, format), name, (int)format, new AndroidSaveImageProxy(callback), false, androidAlbumName); //true = save to internal storage
        }
Example #2
0
        public string AddContact(Contact contact)
        {
            if (nativeProvider == null)
            {
                return(NullNativeProviderMessage);
            }

            string[] phoneNumbersLabels = null;
            string[] phoneNumbers       = null;
            if (contact.PhoneNumbers != null)
            {
                phoneNumbersLabels = contact.PhoneNumbers.Select(p => p.Key).ToArray();
                phoneNumbers       = contact.PhoneNumbers.Select(p => p.Value).ToArray();
            }

            string[] emailsLabels = null;
            string[] emails       = null;
            if (contact.Emails != null)
            {
                emailsLabels = contact.Emails.Select(e => e.Key).ToArray();
                emails       = contact.Emails.Select(e => e.Value).ToArray();
            }

            string birthdayString = contact.Birthday != null?contact.Birthday.Value.ToString("yyyy-MM-dd") : null;

            return(nativeProvider.Call <string>(NativeAddContactMethodName,
                                                contact.FirstName, contact.MiddleName, contact.LastName,
                                                contact.Company, birthdayString,
                                                phoneNumbersLabels, phoneNumbers,
                                                emailsLabels, emails, TextureUtilities.Encode(contact.Photo, ImageFormat.PNG)));
        }
Example #3
0
        public void SaveImage(Texture2D image, string name, ImageFormat format = ImageFormat.JPG, Action <string> callback = null)
        {
            if (callback == null)
            {
                Debug.LogError(NullCallbackMessage);
                return;
            }

            if (image == null)
            {
                callback(NullImageMessage);
                return;
            }

            if (nativeGallery == null)
            {
                callback(NullNativeGalleryMessage);
                return;
            }

            nativeGallery.Call(NativeSaveImageName, TextureUtilities.Encode(image, format), name, (int)format, new AndroidSaveImageProxy(callback), false); // false = saveToInternal
        }