Exemplo n.º 1
0
    public void ShareImage()
    {
        //if you want to save on Application.persistentDataPath, file on this path is remove when app is uninstal
        //string screenShotName = "AndroidUltimateScreenShot.png";
        //string path = Application.persistentDataPath + "/" + screenShotName;

        string screenShotName = "AUPScreenShot.jpg";
        string folderPath     = utilsPlugin.CreateFolder("MyScreenShots", 0);
        string path           = "";

        if (!folderPath.Equals("", StringComparison.Ordinal))
        {
            // test create no media file
            string nomediaPath = utilsPlugin.WriteNoMediaFile(folderPath);
            Debug.Log(" nomediaPath " + nomediaPath);
            //utilsPlugin.ShowToast( " nomediaPath " + nomediaPath);
            path = folderPath + "/" + screenShotName;

            //note: we added new required variable to pass which is screenShotName to determined what image format to use
            //jpg or png, if format is not given set default to jpg format
            StartCoroutine(AUP.Utils.TakeScreenshot(path, screenShotName));
            sharePlugin.ShareImage("subject", "subjectContent", path);
            utilsPlugin.RefreshGallery(path);
        }

        //test
        folderPath = utilsPlugin.CreateFolder(".tg_images", 0);

        if (!folderPath.Equals("", StringComparison.Ordinal))
        {
            string nomediaPath = utilsPlugin.WriteNoMediaFile(folderPath);
            Debug.Log("2nd nomediaPath " + nomediaPath);
            //utilsPlugin.ShowToast( "2nd nomediaPath " + nomediaPath);
        }
    }