[Solved] Is native share only working for external URLs?

Hey cocoon,

I would like to share the screenshot I can get using Cocoon.Utils.captureScreen();
Unfortunately Cocoon.Share.share() will only work if I use external URLs…
Am I doing something wrong or does it simply not work?
In case it does not work like that, is there any other possibility to share the screenshot?

Regards :slightly_smiling:

Hi @Geograman,

Have you tried saving the screenshot in a tmp file and then share it?

Good luck!

Hey Blue,

Do you mean like that:

var screenshotURL = Cocoon.Utils.captureScreen(“myScreenshot.png”, “TEMPORARY_STORAGE”);

console.log('screenshotURL: ’ + screenshotURL);

Cocoon.Share.share({

 message: "myScreenshot (:",
 image: screenshotURL

}, function(activity, completed, error){

//alert("Share " + completed ? 'Ok' : 'Failed');

});

Does not really work.
You can actually share but the picture will not show :confused:

Regards

You were right, that method only works with external URLs and Base64 images.

Try something like this:

`

Native Share Example `

Credit to: http://stackoverflow.com/a/20285053

Thank you very much Blue_Sialia
That works very well.
I wrapped it into a small extension code to make it a bit easier for anyone else.

Wow! Great work!

If you want, you can share this as a post in the Tutorials’ category of this forums. That way we can reference it from our docs.

I’ll flag this as Solved and close the thread.

Have fun!