Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by Divinitize1 · Aug 12, 2019 at 04:06 AM · androidscreenshot

Cant take screenshots on Android with ScreenCapture.CaptureScreenshot

It works fine on PC using Persistent data path.

 ScreenCapture.CaptureScreenshot(Application.persistentDataPath + "/" + "screenshot.png");

However using that on Android doubles up on the path. And using just

 ScreenCapture.CaptureScreenshot("screenshot.png");

Doesn't do anything at all.

Any suggestions? I've already checked so many forum posts but am yet to find a solution.

Comment
Add comment · Show 2
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Grish_tad · Aug 12, 2019 at 01:40 PM 0
Share

Have you checked permissions?

avatar image Divinitize1 Grish_tad · Aug 12, 2019 at 03:16 PM 0
Share

How do i do that? In my player settings i have - Install location - Prefer External - Write Permission - Internal. Do i need to do anything with manifest? I'm already saving data to and from the device so i can only assume i already have some permissions.

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by ako_unity · Aug 12, 2019 at 02:02 PM

First of all, you'll need to get all required permissions from Android OS: an access to disk storage and maybe something to be able to capture screen (this is potentially makes user vulnerable to data stealing, so should be protected somehow). Check this out.

Comment
Add comment · Show 8 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Divinitize1 · Aug 12, 2019 at 03:11 PM 0
Share

Hi you said check this out but didn't link anything, how can i set permissions during development do i add something to manifest?

avatar image xxmariofer Divinitize1 · Aug 12, 2019 at 03:52 PM 0
Share

how did you check if the screenshot was saved? for adding permissions you need to upodate the manifest but i dont remember having to add anything when i once did it but was a long time ago i am not sure

avatar image Divinitize1 xxmariofer · Aug 12, 2019 at 03:58 PM 0
Share

This is all part of an Email/Feedback script I'm working on, so when I load the UI a screenshot is taken, then if the user selects attach screenshot it attaches the screenshot in the email. However, pressing send doesn't do anything when attach screenshot is selected, it works at sending an email without one.Everything works on PC.

 public void OpenUI()
   {
     StartCoroutine(TakeScreenshot());
   }
   public IEnumerator TakeScreenshot()
   {
     yield return new WaitForEndOfFrame();
     // if(File.Exists("feedback"))
     // {
     //   File.Delete("feedback");
     // }
     // yield return new WaitForSeconds(1f);
     ScreenCapture.CaptureScreenshot("feedback.png");
     yield return new WaitForSeconds(.5f);
     Continue();
   }
   public void Update()
   {
     chosenSubject = DropDownUI.GetComponent<T$$anonymous$$Pro.T$$anonymous$$P_Dropdown>().value;
     typed$$anonymous$$essage = inputUI.GetComponent<T$$anonymous$$Pro.T$$anonymous$$P_InputField>().text;
     attachScreenshot = checkboxUI.GetComponent<Toggle>().isOn;
 
     if(attachScreenshot)
     {
       ToggleI$$anonymous$$G.sprite = toggleOn;
     }
     if(!attachScreenshot)
     {
       ToggleI$$anonymous$$G.sprite = toggleOff;
     }
   }
 
   public void Continue()
   {
     Time.timeScale = 0;
     FeedbackUI.SetActive(true);
   }
   public void SendEmails()
   {
       mailBody = typed$$anonymous$$essage;
       if(chosenSubject == 0)
       {
         mailSubject = "BUG";
       }
       if(chosenSubject == 1)
       {
         mailSubject = "FEEDBAC$$anonymous$$";
       }
       if(chosenSubject == 2)
       {
         mailSubject = "OTHER";
       }
       mail.From = new $$anonymous$$ailAddress("E$$anonymous$$AIL");
       mail.To.Add("E$$anonymous$$AIL");
       if(attachScreenshot)
       {
         mail.Attachments.Add(new Attachment ("feedback.png"));
       }
       SmtpClient smtpServer = new SmtpClient("smtp.gmail.com.");
       smtpServer.Port = 587;//GIVE CORRECT PORT HERE
       mail.Subject = mailSubject;
       mail.Body = mailBody;
       smtpServer.Credentials = new System.Net.NetworkCredential("E$$anonymous$$AIL", "PASS") as ICredentialsByHost;
       smtpServer.EnableSsl = true;
       ServicePoint$$anonymous$$anager.ServerCertificateValidationCallback =
       delegate (object s, X509Certificate certificate, X509Chain chain, SslPolicyErrors sslPolicyErrors)
       { return true; };
       smtpServer.Send(mail);
       //smtpServer.SendAsync(mail)
       $$anonymous$$ainBodyUI.SetActive(false);
       ResultBodyUI.SetActive(true);
       ResultTitle.text = "SUCCESS";
       ResultBody.text = "Feedback Sent Succesfully.";
   }

Show more comments

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

238 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Save Image to Android Photo gallery 1 Answer

How to save screenshots on Android with Unity and C#? 0 Answers

Share Button 3 Answers

Save Screenshot and Show it in Gallery (iOS & Android) 3 Answers

Black screenshot of the Unity app from Android 0 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges