- Home /
Email attachment on Android
Hello,
I was wondering how the game Hill Climb Racing managed to attach a screenshot when sharing with gmail.
Basically, If i click on Share on the image below, i will have several choices to share my image to ( It writes, "Share Using ..." )
If i choose gmail, i will have a generic text + screenshot attached.
I have tried to achieve the same thing by using the following :
Application.CaptureScreenshot(Application.persistentDataPath + "/Screenshot.png");
Application.OpenURL("mailto:?subject=subject&body=bodytest"&attachment=" +Application.persistentDataPath + "/Screenshot.png");
When testing the line above, the OS prompts me with :
"Complete action using"
Compose (Email)
Compose (Gmail)
When hitting gmail, my body + subject is correct. However, no screenshot is attached
It looks like Hill Climb racing uses a different method since it says "Share using" even though on my side it says "Complete action using"
Do you have an idea ?
Answer by PAEvenson · Dec 18, 2012 at 02:01 PM
Ive tried this also and I believe android security prevents you from adding attachments.
I think you can do it by doing it by a web server...like in this post http://answers.unity3d.com/questions/194399/send-email-from-unity.html
Answer by Voxel-Busters · Aug 12, 2015 at 09:36 AM
You can use Application.OpenURL with mailto: scheme for normal mail content.
There is no direct way to send html text and attachments. You need to use a plugin.
Cross Platform Native Plugins allows share via
E-Mail
SMS
Facebook
Twitter
Whats-App
It supports iOS and Android platforms with a unified interface.
You can send HTML text as body here and supports attachments. The plugin is free to use for sharing feature.
Your answer
![](https://koobas.hobune.stream/wayback/20220613085305im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Take a Screenshot and Automatically have it Emailed to My Email (Android/iPhone) 0 Answers
adding a share button. 0 Answers
Share Screenshot Image to Facebook with Facebook SDK 0 Answers
Share image in Unity Game on Android devices error 2 Answers
C# Android Application.OpenURL() sends email, but app hangs after 0 Answers