Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 11 Next capture
2021 2022 2023
1 capture
11 Jun 22 - 11 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 Mikenekro · Jul 05, 2015 at 09:22 PM · androidmobilescreenshotemail

Unity Android Streaming Assets Save/Recall w/ WWW class?

I have been trying to access a file that is being created in my Android app and have had no luck so far. What I am doing is taking a screenshot or a picture then sending that picture out through email with Smtp(If that's the correct term it goes by). On my PC(Not on Android) I have tested the method of capturing the photo with

Application.CaptureScreenshot(Application.dataPath + "/StreamingAssets" + "filename" + pictureNumber + ".png");

and sending that photo as an attachment in an email with

'var pathToImage = Application.dataPath + "/StreamingAssets" + "filename" + pictureNumber + ".png";

string attachmentPath = pathToImage1;

System.Net.Mail.Attachment attachment = new System.Net.Mail.Attachment(attachmentPath);

mail.Attachments.Add(attachment);'

And that method worked flawlessly. Send the screenshot as an attachment in an email with no problems on my computer.

The problem comes when converting that path to work with Android. I can send an email with a message, subject and body from Android no problem, but Android seems to not like emails with attachments.

I replaced the path to save and attach (from the windows path to Androids path) 'path = "jar:file://" + Application.dataPath + "!/assets/";' as stated in unity's streaming assets document. Found here: http://docs.unity3d.com/Manual/StreamingAssets.html I believe the photo will not attach to the email with this method because it's compressed in a jar format.

At the bottom of that page it states: "Note that on Android, the files are contained within a compressed .jar file (which is essentially the same format as standard zip-compressed files). This means that if you do not use Unity’s WWW class to retrieve the file then you will need to use additional software to see inside the .jar archive and obtain the file."

So my questions are... How can I use the WWW class to retrieve the photo I have saved to the android device?

Will it allow me to reference the path after it has been retrieved so I can send it through the email?

Is there a better path to save a photo taken in an app?

Lastly, am I approaching this problem in the wrong way?

Something seems off about using the WWW class to retrieve a screenshot photo taken by an android device. I have been looking into purchasing the plugin Capture and Save in the assets store, but I fear that the problem is with the attachment not being able to retrieve the file from the path or sending an email with an attachment rather then taking the screenshot.

EDIT Linux Servers? EDIT I have an idea on getting this to work but may need some direction on where to start. I have a few VPS(Virtual Private Servers) Hosted through a website. They are Linux shells and don't have much ram or storage space but I can always buy more space if needed.

Is it possible to send the photos taken in my app for Android to my Linux servers and then run the C# code to send out the email with an attachment?

I know the code itself will run on a Windows PC and send out the attachment, and I know I will need to setup the code in Unity to connect to the server and transfer files between them.

I have pushed files to my servers through CMD and a Linux Terminal with SSH so they are still setup to use SSH to set them up for taking the data from my app.

If this seems like a better approach then messing around with plugins, could someone give me some advice?

Thanks

Comment
Add comment
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

0 Replies

· Add your reply
  • Sort: 

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

2 People are following this question.

avatar image avatar image

Related Questions

Sending Mobile Email via Unity 2 Answers

Application.OpenURL for email on mobile 4 Answers

Take a Screenshot and Automatically have it Emailed to My Email (Android/iPhone) 0 Answers

Falling Character needs its position reset after swipe 1 Answer

Send HTML email to native email client 3 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