Share Image Android / iOS
Hey. I have a "Share" button script that sends a screenshot of the screen. How can I send any other image?
I tried to work with the folders StreamingAssets and Resource. But for some reason, it did not work.
The task is to replace screenShotPath with a link to own image * .png.
public static string content;
public string ScreenshotName = "screenshot.png";
public void Sharing (){
Application.CaptureScreenshot(ScreenshotName);
ShareScreenshotWithText (content);
}
public void ShareScreenshotWithText(string text)
{
text = content;
string screenShotPath = Application.persistentDataPath + "/" + ScreenshotName;
Share(text,screenShotPath,"");
}
Answer by Voxel-Busters · Jun 09, 2017 at 04:47 AM
You need to keep your asset in Streaming assets and pass Application.streamingAssetsPath appended with your file name.
Note that, on Android Streaming Assets will be as a compressed jar and already streamingAssetsPath covers the "Jar://" scheme by default and nothing much to do if you use Application.streamingAssetsPath to make it cross compatible.
We made a plugin which is compatible on iOS and Android , easy to use unified API and battle tested!