public void OnLocalNotificationPress() { string message = "This is a local notification! This is a super long one to show how long we can make a notification. " + "On Android this will appear as an extended notification."; NativeToolkit.ScheduleLocalNotification("Hello there", message, 1, 0, "sound_notification", true, "ic_notification", "ic_notification_large"); }
public void CRSaveScreenshot() { //StartCoroutine(TakeScreenshot()); string myFileName = "AR_Screenshot" + DateTime.Now.Hour + DateTime.Now.Minute + DateTime.Now.Second + ".jpg"; string myScreenshotLocation; ScreenCapture.CaptureScreenshot(myFileName); try { string path = Application.persistentDataPath; AndroidJavaClass jc = new AndroidJavaClass("android.os.Environment"); path = jc.CallStatic <AndroidJavaObject>("getExternalStoragePublicDirectory", jc.GetStatic <string>("DIRECTORY_DCIM")).Call <string>("getAbsolutePath"); NativeToolkit.SaveScreenshot(myFileName, path + "/VisEonARScreenshots"); myScreenshotLocation = path + "/VisEonARScreenshots/" + myFileName; new WaitForSeconds(2); //REFRESHING THE ANDROID PHONE PHOTO GALLERY AndroidJavaClass classPlayer = new AndroidJavaClass("com.unity3d.player.UnityPlayer"); AndroidJavaObject objActivity = classPlayer.GetStatic <AndroidJavaObject>("currentActivity"); AndroidJavaClass classUri = new AndroidJavaClass("android.net.Uri"); AndroidJavaObject objIntent = new AndroidJavaObject("android.content.Intent", new object[2] { "android.intent.action.MEDIA_SCANNER_SCAN_FILE", classUri.CallStatic <AndroidJavaObject>("parse", "file://" + myScreenshotLocation) }); objActivity.Call("sendBroadcast", objIntent); SendToastyToast("Screenshot has been saved to " + myScreenshotLocation); //NativeToolkit.ShowConfirm("Screenshot", "Screenshot has been saved to " + path); } catch { } }
/* * * Función encargada de notificar al usuario en caso de existir algún mensaje nuevo * en un hilo al cuál se haya suscrito previamente * */ public void Notificar(string tema, string hilo) { NativeToolkit.ClearAllLocalNotifications(); NativeToolkit.ScheduleLocalNotification("Nuevos comentarios en el tema " + tema, "Alguien ha comentado en el siguiente hilo al cuál está suscrito " + hilo); }
private void TakePictureCallback(string path) { if (path != null) { // Create a Texture2D from the captured image in the cache Texture2D texture = NativeCamera.LoadImageAtPath(path, 1024); if (texture == null) { Debug.Log("Couldn't load texture from " + path); return; } // create sprite from the texture Sprite newSprite = Sprite.Create(texture, new Rect(Vector2.zero, new Vector2(texture.width, texture.height)), new Vector2(.5f, .5f)); if (!Permission.HasUserAuthorizedPermission(Permission.ExternalStorageWrite)) { Permission.RequestUserPermission(Permission.ExternalStorageWrite); } if (!Permission.HasUserAuthorizedPermission(Permission.ExternalStorageWrite)) { NotificationManager.Instance.ShowNotification("External Write Permission Required"); return; } PathOfCurrentImage = NativeToolkit.SaveImage(texture, "Recipes"); print($"CameraManager: Path of Image {PathOfCurrentImage}"); OnPictureTaken?.Invoke(newSprite); } }
void SnapShot() { //ScreenCapture capture = GetComponent<ScreenCapture>(); // string filePath; // string subPath; //#if UNITY_ANDROID && !UNITY_EDITOR // subPath = Constants.PhoneSDCardPath; // filePath = subPath + capture.GetFileName(resolution.width, resolution.height); //#elif UNITY_EDITOR // subPath = Application.dataPath + "/Screenshots/"; // if (!Directory.Exists(subPath)) // Directory.CreateDirectory(subPath); // filePath = subPath + capture.GetFileName(resolution.width, resolution.height); //#endif // Debug.Log("File path: " + filePath); // capture.SaveScreenshot(CaptureMethod.ReadPixels_Asynch, filePath); // Directory.GetFiles(filePath); //float x = (Screen.width * 0.5f) - (resolution.width * 0.5f); //float y = Screen.height - resolution.height; //Rect rect = new Rect(x, y, resolution.width, resolution.height); //NativeToolkit.SaveScreenshot(ScreenCapture.GetFileName(resolution.width, resolution.height), Application.productName, screenArea: rect); Texture2D tex = new Texture2D(_camTex.width, _camTex.height); tex.SetPixels(_camTex.GetPixels()); tex.Apply(); string fileName = ScreenCapture.GetFileName(resolution.width, resolution.height); NativeToolkit.SaveImage(tex, fileName); }
public void OnFacebookLogoutPress() { NativeToolkit.FacebookLogout(); userName.text = "User Name"; Id.text = "Id"; profilePic.sprite = defaultImage; }
void Start() { console.text += "\nLocation enabled: " + NativeToolkit.StartLocation(); console.text += "\nDevice country: " + NativeToolkit.GetCountryCode(); console.text += "\nLanguage: " + NativeToolkit.GetLanguage(); console.text += "\nLaunched from notification: " + NativeToolkit.WasLaunchedFromNotification(); console.text += "\nGet I18N Text: " + NativeToolkit.GetText("native_toolkit_button_ok"); }
public void SetupLocalNotifications(int delayInMin, int days) { for (int i = 0; i < days; i++) { NativeToolkit.ScheduleLocalNotification("GET FIT", "Wie wär's mit einem Workout?", 0, delayInMin + (1440 * i), "default_sound", true, "ic_notification", "ic_notification_large"); } }
//--------------------------------------------------------------------- void Start() { string s = ""; s += "Location enabled:" + NativeToolkit.StartLocation(); s += " Device country:" + NativeToolkit.GetCountryCode(); s += " Launched from Notification:" + NativeToolkit.WasLaunchedFromNotification(); Debug.Log(s); }
// 스크린샷 수행 public void SaveScreenshot() { //찰칵소리 _audioSource.Play(); // NativeToolkit을 이용해 스크린샷을 저장함 NativeToolkit.SaveScreenshot("Screenshot_" + System.DateTime.Now.ToString(), "/storage/emulated/0/DCIM/Screenshots", "PNG"); //NativeToolkit.SaveScreenshot("Screenshot_" + System.DateTime.Now.ToString("yyyy-MM-dd-HH-mm-ss"), // "/storage/emulated/0/DCIM/Screenshots", "PNG"); }
void Update() { if (isUpdate) { isUpdate = false; Debug.Log("UpdateSchedule"); calendarPanel.UpdateSchedules(schedules); schedules.Clear(); NativeToolkit.ScheduleLocalNotification(noticeStr, noticeContent, 1, noticeMin, "sound_notification", true, "ic_notification", "ic_notification_large"); } }
public void SavePhoto() { if (RunOnRealPhone) { NativeToolkit.SaveImage(texture2Save, "KARARA" + savedPhotoCount.ToString()); } else { Debug.Log("save image KARARA" + savedPhotoCount.ToString()); } savedPhotoCount++; }
public void Take() { Assert.IsNotNull(UTXO, "You forgot to initialize the UTXO for this button"); if (Application.platform == RuntimePlatform.WindowsEditor) { OnCameraShotComplete(DebugTexture, ""); } else { NativeToolkit.OnCameraShotComplete += OnCameraShotComplete; NativeToolkit.TakeCameraShot(); } }
public void OnShareButton() { string fileName = PlayerPrefs.GetString("CurrentSkinPath"); fileName = System.IO.Path.GetFileNameWithoutExtension(fileName); if (PlayerPrefs.GetInt("HasPurchasedIAP") == 1) { NativeToolkit.SaveImage(stevePaintable.GetComponent <Steve>().GetCurrentSkinTexture(), fileName, "png"); } else { inappPurchase.SetActive(true); } }
public void TakeScreenshot() { try { uiWrapper.alpha = 0; groundPlane.SetActive(!cameraOnlyToggle.isOn); uiCanvas.SetActive(!cameraOnlyToggle.isOn); planeFinder.SetActive(false); NativeToolkit.SaveScreenshot($"Screenshot"); } catch (Exception e) { debugText.text = e.Message; } }
public static void SetupLocalNotificationsOnReboot(int h, int m, int days) { NativeToolkit.ClearAllLocalNotifications(); DateTime dt = DateTime.Now.Date.AddDays(1); TimeSpan ts = new TimeSpan(h, m, 0); dt = dt.Date + ts; TimeSpan delay = dt - DateTime.Now; int delayInMin = (int)delay.TotalMinutes; for (int i = 0; i < days; i++) { NativeToolkit.ScheduleLocalNotification("GET FIT", "Hi, wie wär's mit einem Workout?", 0, delayInMin + (1440 * i), "default_sound", true, "ic_notification", "ic_notification_large"); } }
void OnEnable() { //btnMenu.onClick.AddListener(() => HomePanel.OpenPanel()); //btnMenu.onClick.AddListener(() => OnBarsToggled(this, false)); //btnMenu.onClick.AddListener(delegate { ToggleMenu(); } ); btnLoad.onClick.AddListener(() => DetailPanel.OpenPanel()); btnLoad.onClick.AddListener(() => StartApp()); btnDetails.onClick.AddListener(() => DetailPanel.OpenPanel()); btnDetails.onClick.AddListener(() => StopFeed()); btnRadiograph.onClick.AddListener(() => RadiographsPanel.OpenPanel()); btnRadiograph.onClick.AddListener(() => StopFeed()); btnMovement.onClick.AddListener(() => MovementPanel.OpenPanel()); btnMovement.onClick.AddListener(() => StopFeed()); btnSimulation.onClick.AddListener(() => SimulationPanel.OpenPanel()); btnSimulation.onClick.AddListener(() => StopFeed()); btnVideo.onClick.AddListener(() => VideoPanel.OpenPanel()); btnVideo.onClick.AddListener(() => StopFeed()); btnCamera.onClick.AddListener(() => CameraPanel.OpenPanel()); btnCamera.onClick.AddListener(() => LaunchFeed()); btnSnapshot.onClick.AddListener(() => SnapShot()); btnGallery.onClick.AddListener(() => NativeToolkit.PickImage()); Core.SubscribeEvent("OnPanelOpened", OnPanelOpened); Core.SubscribeEvent("OnToggleBars", OnBarsToggled); InputControls.GestureDetected += OnGestureDetected; //Moverio 4.5 ~ 4.6 with Input.GetMouse events InputControls.BackButtonPressed += InputControls_BackButtonPressed; InputControls.MenuButtonPressed += InputControls_MenuButtonPressed; NativeToolkit.OnImageSaved += NativeToolkit_OnImageSaved; ARDirectoryManager.OnImageLoadComplete += ARDirectoryManager_OnImageLoadComplete; }
public void OnToggle() { if (GameManager.instance.hasUnlockedNotifications) { if (notificationToggle.isOn) { int _h = int.Parse(hours.text); int _m = int.Parse(minutes.text); h = _h; m = _m; DateTime dt = DateTime.Now.Date.AddDays(1); TimeSpan ts = new TimeSpan(_h, _m, 0); dt = dt.Date + ts; TimeSpan delay = dt - DateTime.Now; int delayInMin = (int)delay.TotalMinutes; SetupLocalNotifications(delayInMin, 7); } else { NativeToolkit.ClearAllLocalNotifications(); } } }
public void OnShowDialogPress() { NativeToolkit.ShowConfirm("Native Toolkit", "This is a confirm dialog!", DialogFinished); }
public void OnShowAlertPress() { NativeToolkit.ShowAlert("Native Toolkit", "This is an alert dialog!", DialogFinished); }
public void OnPickContactPress() { NativeToolkit.PickContact(); }
public void OnCameraPress() { NativeToolkit.TakeCameraShot(); }
public void OnEmailSharePress() { NativeToolkit.SendEmail("Hello there", "<html><body><b>This is an email sent from my App!</b></body></html>", imagePath, "", "", ""); }
public void OnSaveImagePress() { NativeToolkit.SaveImage(texture, "MyImage", "png"); }
//============================================================================= // Button handlers //============================================================================= public void OnSaveScreenshotPress() { NativeToolkit.SaveScreenshot("MyScreenshot", "MyScreenshotFolder", "jpeg"); }
void Start() { console.text += "\nLocation enabled: " + NativeToolkit.StartLocation(); console.text += "\nDevice country: " + NativeToolkit.GetCountryCode(); console.text += "\nLaunched from notification: " + NativeToolkit.WasLaunchedFromNotification(); }
public void OnRateAppPress() { NativeToolkit.RateApp("Rate This App", "Please take a moment to rate this App", "Rate Now", "Later", "No, Thanks", "343200656", AppRated); }
public void OnClearNotificationsPress() { NativeToolkit.ClearAllLocalNotifications(); }
public void OnGetLocationPress() { console.text += "\nLongitude: " + NativeToolkit.GetLongitude().ToString(); console.text += "\nLatitude: " + NativeToolkit.GetLatitude().ToString(); }
public void OnPickImagePress() { NativeToolkit.PickImage(); }