public override void Test() { SA_ScreenUtil.TakeScreenshot((screenshot) => { ISN_Mail.Send("Mail Subject", "Mail Body", "*****@*****.**", screenshot, (result) => { SetAPIResult(result); }); }); }
public void TakeVideo(int maxThumbnailSize, Action <UM_MediaResult> callback) { SA_ScreenUtil.TakeScreenshot(maxThumbnailSize, (image) => { var media = new UM_Media(image, image.EncodeToPNG(), string.Empty, UM_MediaType.Video); var result = new UM_MediaResult(media); callback.Invoke(result); }); }
public override void Test() { SA_ScreenUtil.TakeScreenshot((screenshot) => { ISN_Facebook.Post("share text", screenshot, (result) => { SetAPIResult(result); }); }); }
public override void Test() { SA_ScreenUtil.TakeScreenshot((screenshot) => { ISN_TextMessage.Send("Hello Google", "+18773555787", screenshot, (result) => { SetResult(SA_TestResult.OK); }); }); }
public void TakePicture(int maxThumbnailSize, Action <UM_MediaResult> callback) { SA_ScreenUtil.TakeScreenshot(maxThumbnailSize, (image) => { var media = new UM_Media(image, string.Empty, UM_MediaType.Image); var result = new UM_MediaResult(media); callback.Invoke(result); }); }
public void PickVideo(int thumbnailSize, Action <UM_MediaResult> callback) { SA_ScreenUtil.TakeScreenshot(thumbnailSize, (image) => { var media = new UM_Media(image, string.Empty, UM_MediaType.Video); var result = new UM_MediaResult(media); callback.Invoke(result); }); }
public override void Test() { SA_ScreenUtil.TakeScreenshot((tex) => { ISN_UIImagePickerController.SaveTextureToCameraRoll(tex, (result) => { SetAPIResult(result); }); }); }
private void ReadAndWrite(string name) { var client = AN_Games.GetSnapshotsClient(); client.Open(name, m_createIfNotFound, m_conflictPolicy, (result) => { if (result.IsSucceeded) { AN_Logger.Log("We have snapshot, reading data..."); AN_Snapshot snapshot = result.Data.GetSnapshot(); byte[] data = snapshot.ReadFully(); var meta = snapshot.GetMetadata(); m_progress = meta.ProgressValue + 10; m_playedTime = meta.PlayedTime + 100; string base64Text = Convert.ToBase64String(data); AN_Logger.Log("Snapshot data: " + base64Text); PrintSnapshotMetadata(snapshot.GetMetadata()); AN_Logger.Log("Writing data..."); m_snpashotData = "My game data " + name; data = m_snpashotData.ToBytes(); snapshot.WriteBytes(data); SA_ScreenUtil.TakeScreenshot(512, (screenshot) => { var changeBuilder = new AN_SnapshotMetadataChange.Builder(); changeBuilder.SetDescription("Hello Description"); changeBuilder.SetPlayedTimeMillis(m_playedTime); changeBuilder.SetProgressValue(m_progress); changeBuilder.SetCoverImage(screenshot); AN_SnapshotMetadataChange changes = changeBuilder.Build(); client.CommitAndClose(snapshot, changes, (commitResult) => { if (commitResult.IsSucceeded) { PrintSnapshotMetadata(commitResult.Metadata); VerifySnapshotsSave(name); } else { SetAPIResult(result); } }); }); } else { SetAPIResult(result); } }); }
private void OpenSnapshot(string name) { var client = AN_Games.GetSnapshotsClient(); bool createIfNotFound = true; var conflictPolicy = AN_SnapshotsClient.ResolutionPolicy.LAST_KNOWN_GOOD; client.Open(name, createIfNotFound, conflictPolicy, (result) => { if (result.IsSucceeded) { Debug.Log("We have snapshot, reading data..."); AN_Snapshot snapshot = result.Data; byte[] data = snapshot.ReadFully(); long progress = snapshot.GetMetadata().ProgressValue; string base64Text = Convert.ToBase64String(data); Debug.Log("Snapshot data: " + base64Text); Debug.Log("Snapshot progress: " + snapshot.GetMetadata().ProgressValue); Debug.Log("Snapshot played time: " + snapshot.GetMetadata().PlayedTime); Debug.Log("Writing data..."); string mydata = "My game data"; data = mydata.ToBytes(); snapshot.WriteBytes(data); SA_ScreenUtil.TakeScreenshot(512, (screenshot) => { var changeBuilder = new AN_SnapshotMetadataChange.Builder(); changeBuilder.SetDescription("Hello Description"); changeBuilder.SetPlayedTimeMillis(10000); changeBuilder.SetProgressValue(progress + 1); changeBuilder.SetCoverImage(screenshot); AN_SnapshotMetadataChange changes = changeBuilder.Build(); client.CommitAndClose(snapshot, changes, (commitResult) => { if (commitResult.IsSucceeded) { PrintMeta(commitResult.Metadata); } else { Debug.Log("CommitAndClose Snapshots Failed: " + result.Error.FullMessage); } }); }); } else { Debug.Log("Open Snapshots Failed: " + result.Error.FullMessage); } }); }
public override void Test() { SA_ScreenUtil.TakeScreenshot((screenshot) => { AN_Gallery.SaveImageToGallery(screenshot, "Example Scnee", (result) => { if (result.IsSucceeded) { AN_Logger.Log("Screenshot has been saved to: " + result.Path); } SetAPIResult(result); }); }); }
public void FacebookButton() { #if UNITY_IOS SA_ScreenUtil.TakeScreenshot((image) => { Debug.Log("Image Ready"); ISN_Facebook.Post("I am passing time on Drifty Squirrel with a high score of " + GameControllerScript.Instance.HighScore.ToString("N0") + " points. Check it out!", image, (result) => { Debug.Log("Post result: " + result.IsSucceeded); }); }); #endif }
public override void Test() { SA_ScreenUtil.TakeScreenshot(256, (screenshot) => { var composer = new AN_ShareComposer(); composer.SetTitle("Android Native Share Example"); composer.SetText("Hello world"); composer.AddImage(screenshot); composer.AddImage(screenshot); composer.Share(() => { Debug.Log("Sharing flow is finished, User has retured to the app"); SetResult(SA_TestResult.OK); }); }); }
void Start() { m_twitterText.onClick.AddListener(() => { ISN_Twitter.Post("Yo my man"); }); m_twitterTextImage.onClick.AddListener(() => { SA_ScreenUtil.TakeScreenshot((image) => { ISN_UIActivityViewController controller = new ISN_UIActivityViewController(); controller.SetText("share text"); controller.AddImage(image); controller.ExcludedActivityTypes.Add(ISN_UIActivityType.Message); controller.Present((result) => { if (result.IsSucceeded) { Debug.Log("Completed: " + result.Completed); Debug.Log("ActivityType: " + result.ActivityType); } else { Debug.Log("ISN_UIActivityViewController error: " + result.Error.FullMessage); } }); /* * Debug.Log("Image Ready"); * * ISN_Twitter.Post("Yo my man", image, (result) => { * Debug.Log("Post result: " + result.IsSucceeded); * });*/ }); }); m_fbImage.onClick.AddListener(() => { SA_ScreenUtil.TakeScreenshot((image) => { Debug.Log("Image Ready"); ISN_Facebook.Post("Yo my man", image, (result) => { Debug.Log("Post result: " + result.IsSucceeded); }); }); }); }
public override void Test() { if (!AN_InstagramSharing.IsAppInstalled) { SetResult(SA_TestResult.WithError("No App installed")); return; } SA_ScreenUtil.TakeScreenshot(256, (screenshot) => { var composer = new AN_InstagramSharing(); composer.AddImage(screenshot); // composer.AddImage(screenshot); composer.Share(() => { Debug.Log("Sharing flow is finished, User has retured to the app"); SetResult(SA_TestResult.OK); }); }); }
public override void Test() { SA_ScreenUtil.TakeScreenshot(256, (screenshot) => { var composer = new AN_EmailComposer(); composer.SetText("Hello world"); composer.SetSubject("Testing the emails sharing example"); composer.AddRecipient("*****@*****.**"); composer.AddRecipient("*****@*****.**"); composer.AddImage(screenshot); composer.AddImage(screenshot); composer.Share(() => { Debug.Log("Sharing flow is finished, User has retured to the app"); SetResult(SA_TestResult.OK); }); }); }
private void AndroidBigTextStyle() { SA_ScreenUtil.TakeScreenshot(256, (screenshot) => { var builder = new AN_NotificationCompat.Builder(); builder.SetContentText("Big Text Style"); builder.SetContentTitle("Big TextStyle Title"); var bigTextStyle = new AN_NotificationCompat.BigTextStyle(); bigTextStyle.BigText("This is test big text style"); builder.SetStyle(bigTextStyle); builder.SetDefaults(AN_Notification.DEFAULT_ALL); var trigger = new AN_AlarmNotificationTrigger(); trigger.SetDate(TimeSpan.FromSeconds(1)); var id = SA_IdFactory.NextId; var request = new AN_NotificationRequest(id, builder, trigger); AN_NotificationManager.Schedule(request); }); }
public override void Test() { SA_ScreenUtil.TakeScreenshot((screenshot) => { ISN_UIActivityViewController controller = new ISN_UIActivityViewController(); controller.SetText("share text"); controller.AddImage(screenshot); controller.ExcludedActivityTypes.Add(ISN_UIActivityType.Print); controller.ExcludedActivityTypes.Add(ISN_UIActivityType.AssignToContact); controller.Present((result) => { if (result.IsSucceeded) { Debug.Log("Completed: " + result.Completed); Debug.Log("ActivityType: " + result.ActivityType); } else { Debug.Log("ISN_UIActivityViewController error: " + result.Error.FullMessage); } SetAPIResult(result); }); }); }
/// <summary> /// Saves the screen screenshot to the saved photos album. /// </summary> /// <param name="callback">Callback.</param> public static void SaveScreenshotToCameraRoll(Action <SA_Result> callback) { SA_ScreenUtil.TakeScreenshot((texture) => { SaveTextureToCameraRoll(texture, callback); }); }
private void Start() { m_loadFromGallery.onClick.AddListener(() => { ISN_UIImagePickerController picker = new ISN_UIImagePickerController(); picker.SourceType = ISN_UIImagePickerControllerSourceType.Album; picker.MediaTypes = new List <string>() { ISN_UIMediaType.IMAGE }; picker.MaxImageSize = 512; picker.ImageCompressionFormat = ISN_UIImageCompressionFormat.JPEG; picker.ImageCompressionRate = 0.8f; picker.Present((result) => { if (result.IsSucceeded) { if (result.Image != null) { Debug.Log("User selected an Image: " + result.Image); m_image.sprite = result.Image.ToSprite(); m_go.GetComponent <Renderer>().material.mainTexture = result.Image; } else { Debug.Log("User selected a video at path: " + result.VideoPath); } } else { Debug.Log("Madia picker failed with reason: " + result.Error.Message); } }); }); m_loadFromCamera.onClick.AddListener(() => { ISN_UIImagePickerController picker = new ISN_UIImagePickerController(); picker.SourceType = ISN_UIImagePickerControllerSourceType.Camera; picker.MediaTypes = new List <string>() { ISN_UIMediaType.IMAGE }; picker.Present((result) => { if (result.IsSucceeded) { Debug.Log("Image captured: " + result.Image); m_image.sprite = result.Image.ToSprite(); m_go.GetComponent <Renderer>().material.mainTexture = result.Image; } else { Debug.Log("Madia picker failed with reason: " + result.Error.Message); } }); }); m_saveToGallery.onClick.AddListener(() => { SA_ScreenUtil.TakeScreenshot((image) => { ISN_UIImagePickerController.SaveTextureToCameraRoll(image, (result) => { if (result.IsSucceeded) { Debug.Log("Image saved"); } else { Debug.Log("Error: " + result.Error.Message); } }); }); }); }
public void SaveScreenshot(string fileName, Action <SA_Result> callback) { SA_ScreenUtil.TakeScreenshot(1024, (image) => { SaveImage(image, fileName, callback); }); }
private void Start() { m_loadFromGallery.onClick.AddListener(() => { /* * * ISN_UIImagePickerController picker = new ISN_UIImagePickerController(); * picker.SourceType = ISN_UIImagePickerControllerSourceType.Album; * picker.MediaTypes = new List<string>() { ISN_UIMediaType.IMAGE}; * picker.MaxImageSize = 1024; * picker.ImageCompressionFormat = ISN_UIImageCompressionFormat.JPEG; * picker.ImageCompressionRate = 0.8f; * picker.Present((result) => { * if (result.IsSucceeded) { * Debug.Log("IMAGE local path: " + result.ImageURL); * // mySprite = result.Image.ToSprite(); * } else { * // canceled = true; * Debug.Log("Media picker failed with reason: " + result.Error.Message); * } * }); */ ISN_UIImagePickerController picker = new ISN_UIImagePickerController(); picker.SourceType = ISN_UIImagePickerControllerSourceType.Album; picker.MediaTypes = new List <string>() { ISN_UIMediaType.MOVIE }; picker.Present((result) => { if (result.IsSucceeded) { Debug.Log("MOVIE local path: " + result.MediaURL); try{ byte[] movieBytes = File.ReadAllBytes(result.MediaURL); Debug.Log("movie size bytes: " + movieBytes.Length); } catch (System.Exception ex) { Debug.Log(ex.Message); } } else { // canceled = true; Debug.Log("Media picker failed with reason: " + result.Error.Message); } }); //File /* * * ISN_UIImagePickerController picker = new ISN_UIImagePickerController(); * picker.SourceType = ISN_UIImagePickerControllerSourceType.Album; * picker.MediaTypes = new List<string>() { ISN_UIMediaType.IMAGE, ISN_UIMediaType.MOVIE}; * picker.MaxImageSize = 512; * picker.ImageCompressionFormat = ISN_UIImageCompressionFormat.JPEG; * picker.ImageCompressionRate = 0.8f; * * picker.Present((result) => { * if (result.IsSucceeded) { * switch(result.MediaType) { * case ISN_UIMediaType.IMAGE: * Debug.Log("IMAGE local path: " + result.ImageURL); * m_image.sprite = result.Image.ToSprite(); * m_go.GetComponent<Renderer>().material.mainTexture = result.Image; * break; * case ISN_UIMediaType.MOVIE: * Debug.Log("MOVIE local path: " + result.MediaURL); * Texture2D image = ISN_AVAssetImageGenerator.CopyCGImageAtTime(result.MediaURL, 0); * m_image.sprite = image.ToSprite(); * m_go.GetComponent<Renderer>().material.mainTexture = image; * break; * } * } else { * Debug.Log("Madia picker failed with reason: " + result.Error.Message); * } * }); */ }); m_loadFromCamera.onClick.AddListener(() => { ISN_UIImagePickerController picker = new ISN_UIImagePickerController(); picker.SourceType = ISN_UIImagePickerControllerSourceType.Camera; picker.MediaTypes = new List <string>() { ISN_UIMediaType.IMAGE }; picker.Present((result) => { if (result.IsSucceeded) { Debug.Log("Image captured: " + result.Image); m_image.sprite = result.Image.ToSprite(); m_go.GetComponent <Renderer>().material.mainTexture = result.Image; } else { Debug.Log("Madia picker failed with reason: " + result.Error.Message); } }); }); m_saveToGallery.onClick.AddListener(() => { SA_ScreenUtil.TakeScreenshot((image) => { ISN_UIImagePickerController.SaveTextureToCameraRoll(image, (result) => { if (result.IsSucceeded) { Debug.Log("Image saved"); } else { Debug.Log("Error: " + result.Error.Message); } }); }); }); }
#pragma warning restore 649 private void Awake() { m_shareText.onClick.AddListener(() => { var composer = new AN_ShareComposer(); composer.SetTitle("Android Native Share Example"); composer.SetText("Hello world"); composer.Share(); }); m_shareImage.onClick.AddListener(() => { SA_ScreenUtil.TakeScreenshot((screenshot) => { /* * var composer = new AN_ShareComposer(); * composer.SetTitle("Android Native Share Example"); * composer.SetText("Hello world"); * composer.AddImage(screenshot); * * composer.Share();*/ ShowSharingMenuAndroid(screenshot); }); }); m_shareImages.onClick.AddListener(() => { SA_ScreenUtil.TakeScreenshot((screenshot) => { var composer = new AN_ShareComposer(); composer.SetTitle("Android Native Share Example"); composer.SetText("Hello world"); composer.AddImage(screenshot); composer.AddImage(screenshot); composer.Share(() => { Debug.Log("Sharing flow is finished, User has retured to the app"); }); }); }); m_fbImage.onClick.AddListener(() => { SA_ScreenUtil.TakeScreenshot((screenshot) => { var composer = new AN_FacebookSharing(); composer.AddImage(screenshot); composer.Share(); }); }); m_fbImages.onClick.AddListener(() => { SA_ScreenUtil.TakeScreenshot((screenshot) => { var composer = new AN_FacebookSharing(); composer.AddImage(screenshot); composer.AddImage(screenshot); composer.Share(() => { Debug.Log("Sharing flow is finished, User has retured to the app"); }); }); }); m_instaImage.onClick.AddListener(() => { SA_ScreenUtil.TakeScreenshot((screenshot) => { var composer = new AN_InstagramSharing(); composer.AddImage(screenshot); composer.Share(); }); }); m_instaImages.onClick.AddListener(() => { SA_ScreenUtil.TakeScreenshot((screenshot) => { var composer = new AN_InstagramSharing(); composer.AddImage(screenshot); composer.AddImage(screenshot); composer.Share(); }); }); m_emil.onClick.AddListener(() => { SA_ScreenUtil.TakeScreenshot((screenshot) => { var composer = new AN_EmailComposer(); composer.SetText("Testing the emailssharing\n example"); composer.SetSubject("Hello worls"); composer.AddRecipient("*****@*****.**"); composer.AddRecipient("*****@*****.**"); composer.AddImage(screenshot); // composer.AddImage(screenshot); composer.Share(() => { Debug.Log("Sharing flow is finished, User has retured to the app"); }); }); }); m_twitter.onClick.AddListener(() => { SA_ScreenUtil.TakeScreenshot((screenshot) => { var composer = new AN_TwitterSharing(); composer.AddImage(screenshot); composer.SetText("My twitt"); composer.Share(); }); }); m_whatsup.onClick.AddListener(() => { SA_ScreenUtil.TakeScreenshot((screenshot) => { var composer = new AN_WhatsappSharing(); composer.AddImage(screenshot); composer.AddImage(screenshot); composer.SetText("My message"); composer.Share(); }); }); m_instllCheck.onClick.AddListener(() => { AN_Logger.Log(AN_FacebookSharing.IsAppInstalled); var pm = AN_MainActivity.Instance.GetPackageManager(); var info = pm.GetPackageInfo("random.app.name", AN_PackageManager.GET_ACTIVITIES); if (info == null) { AN_Logger.Log("not installed"); } else { AN_Logger.Log("app installed"); } }); m_startFacebook.onClick.AddListener(() => { var pm = AN_MainActivity.Instance.GetPackageManager(); AN_Intent startAppIntent = pm.GetLaunchIntentForPackage("com.facebook.katana"); if (startAppIntent == null) { AN_Logger.Log("App with Id: com.facebook.katana not found on device"); return; } startAppIntent.AddCategory(AN_Intent.CATEGORY_LAUNCHER); AN_MainActivity.Instance.StartActivity(startAppIntent); }); m_composeSMS.onClick.AddListener(() => { string phoneNumber = "+380956808684"; AN_Intent smsIntent = new AN_Intent(AN_Intent.ACTION_VIEW, new Uri("sms:" + phoneNumber)); smsIntent.PutExtra("sms_body", "Hello, how are you?"); smsIntent.PutExtra(AN_Intent.EXTRA_TEXT, "Hello, how are you ?"); AN_MainActivity.Instance.StartActivity(smsIntent); }); }
private void Awake() { AddFitter(m_image.gameObject); AddFitter(m_sprite.gameObject); m_captureAdvanced.onClick.AddListener(() => { var maxSize = 1024; AN_Camera.CaptureImage(maxSize, (result) => { PrintCaptureResult(result); }); }); m_captureVideo.onClick.AddListener(() => { var maxSize = 1024; AN_Camera.CaptureVideo(maxSize, (result) => { PrintCaptureResult(result); }); }); m_getVideos.onClick.AddListener(() => { var picker = new AN_MediaPicker(AN_MediaType.Video); picker.AllowMultiSelect = true; picker.MaxSize = 512; picker.Show((result) => { PrintPickerResult(result); }); }); m_getMixed.onClick.AddListener(() => { var picker = new AN_MediaPicker(AN_MediaType.Image, AN_MediaType.Video); picker.AllowMultiSelect = true; picker.MaxSize = 512; picker.Show((result) => { PrintPickerResult(result); }); }); m_getPictures.onClick.AddListener(() => { var picker = new AN_MediaPicker(AN_MediaType.Image); // Defines if multiple images picker is allowed. // The default value is < c > false </ c > picker.AllowMultiSelect = true; // Max thumbnail size that will be transferred to the Unity side. // The thumbnail will be resized before it sent. // The default value is 512. picker.MaxSize = 512; // Starts pick media from a gallery flow. picker.Show((result) => { PrintPickerResult(result); }); }); m_saveScreenshot.onClick.AddListener(() => { SA_ScreenUtil.TakeScreenshot(512, (screenshot) => { AN_Gallery.SaveImageToGallery(screenshot, "ExampleScreenshot", (result) => { if (result.IsFailed) { AN_Logger.Log("Filed: " + result.Error.Message); return; } AN_Logger.Log("Screenshot has been saved to: " + result.Path); }); }); }); }