Esempio n. 1
0
    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");
    }
Esempio n. 2
0
    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 { }
    }
Esempio n. 3
0
    /*
     *
     * 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);
    }
Esempio n. 6
0
 public void OnFacebookLogoutPress()
 {
     NativeToolkit.FacebookLogout();
     userName.text     = "User Name";
     Id.text           = "Id";
     profilePic.sprite = defaultImage;
 }
Esempio n. 7
0
 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");
 }
Esempio n. 8
0
 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);
    }
Esempio n. 10
0
 // 스크린샷 수행
 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");
 }
Esempio n. 11
0
 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");
     }
 }
Esempio n. 12
0
 public void SavePhoto()
 {
     if (RunOnRealPhone)
     {
         NativeToolkit.SaveImage(texture2Save, "KARARA" + savedPhotoCount.ToString());
     }
     else
     {
         Debug.Log("save image KARARA" + savedPhotoCount.ToString());
     }
     savedPhotoCount++;
 }
Esempio n. 13
0
 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();
     }
 }
Esempio n. 14
0
    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);
        }
    }
Esempio n. 15
0
        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;
            }
        }
Esempio n. 16
0
    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;
    }
Esempio n. 18
0
    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();
            }
        }
    }
Esempio n. 19
0
 public void OnShowDialogPress()
 {
     NativeToolkit.ShowConfirm("Native Toolkit", "This is a confirm dialog!", DialogFinished);
 }
Esempio n. 20
0
 public void OnShowAlertPress()
 {
     NativeToolkit.ShowAlert("Native Toolkit", "This is an alert dialog!", DialogFinished);
 }
Esempio n. 21
0
 public void OnPickContactPress()
 {
     NativeToolkit.PickContact();
 }
Esempio n. 22
0
 public void OnCameraPress()
 {
     NativeToolkit.TakeCameraShot();
 }
Esempio n. 23
0
 public void OnEmailSharePress()
 {
     NativeToolkit.SendEmail("Hello there", "<html><body><b>This is an email sent from my App!</b></body></html>", imagePath, "", "", "");
 }
Esempio n. 24
0
 public void OnSaveImagePress()
 {
     NativeToolkit.SaveImage(texture, "MyImage", "png");
 }
Esempio n. 25
0
    //=============================================================================
    // Button handlers
    //=============================================================================

    public void OnSaveScreenshotPress()
    {
        NativeToolkit.SaveScreenshot("MyScreenshot", "MyScreenshotFolder", "jpeg");
    }
Esempio n. 26
0
 void Start()
 {
     console.text += "\nLocation enabled: " + NativeToolkit.StartLocation();
     console.text += "\nDevice country: " + NativeToolkit.GetCountryCode();
     console.text += "\nLaunched from notification: " + NativeToolkit.WasLaunchedFromNotification();
 }
Esempio n. 27
0
 public void OnRateAppPress()
 {
     NativeToolkit.RateApp("Rate This App", "Please take a moment to rate this App", "Rate Now", "Later", "No, Thanks", "343200656", AppRated);
 }
Esempio n. 28
0
 public void OnClearNotificationsPress()
 {
     NativeToolkit.ClearAllLocalNotifications();
 }
Esempio n. 29
0
 public void OnGetLocationPress()
 {
     console.text += "\nLongitude: " + NativeToolkit.GetLongitude().ToString();
     console.text += "\nLatitude: " + NativeToolkit.GetLatitude().ToString();
 }
Esempio n. 30
0
 public void OnPickImagePress()
 {
     NativeToolkit.PickImage();
 }