public void OnPickContactFromAddressBook() { AGContacts.PickContact( pickedContact => { var msg = string.Format("Picked contact: {0}, photo URI: {1}, emails: {2}, phones: {3}", pickedContact.DisplayName, pickedContact.PhotoUri, string.Join(",", pickedContact.Emails.ToArray()), string.Join(",", pickedContact.Phones.ToArray()) ); Debug.Log(msg); AGUIMisc.ShowToast(msg); if (!string.IsNullOrEmpty(pickedContact.PhotoUri)) // Not all contacts have image { var contactPicture = AGFileUtils.ImageUriToTexture2D(pickedContact.PhotoUri); image.sprite = SpriteFromTex2D(contactPicture); } }, failureReason => { AGUIMisc.ShowToast("Picking contact failed: " + failureReason); }); }
public IEnumerator TakeScreenshot(int width, int height) { yield return(new WaitForEndOfFrame()); var texture = new Texture2D(width, height, TextureFormat.RGB24, true); texture.ReadPixels(new Rect(0, 0, width, height), 0, 0); texture.Apply(); _lastTakenScreenshot = texture; var imageTitle = "Screenshot-" + System.DateTime.Now.ToString("yy-MM-dd-hh-mm-ss"); const string folderName = "Goodies"; AGFileUtils.SaveImageToGallery(_lastTakenScreenshot, imageTitle, folderName, ImageFormat.JPEG); AGUIMisc.ShowToast(imageTitle + " saved to gallery"); }