Screenshot sharing - iOS & Android

  • 31 favourites



7,576 visits, 22,770 views



This tutorial hasn't been translated.


This tutorial is licensed under CC BY 4.0. Please refer to the license text if you wish to reuse, share or remix the content contained within this tutorial.


This next section of the tutorial is to take that screenshot and send it off to twitter, facebook, mail, messages and loads more depending on what you have installed on your phone.

Firstly, we need a share button. For mine its a simple click-able sprite. And once its clicked ("Touch > On touched object") add the event "Browser > Execute Javascript". Now this is where it gets a little bit creative.

Before we start writing the script for the custom message, head to: and read the documentation, this gives all the possible combinations.

What ever message combination you choose to go with, your going to want to start with "window.plugins.socialsharing.share. This calls the plugin when added to the execute javascript action.

Now we will add the content to the end of that code snippet. I used this example:

    ('My message',
          'PhoneGap share plugin',

Change "My message" to what ever message you want to post with the screenshot.

Change "PhoneGap share plugin" to the screenshots name (can be anything, I went with GATE)

Change "" to the variable "ScreenshotLink". To add this you need to use "& VariableName &" (including the ""). This will call up the name of the saved screenshot. This method can be used in any section of this code. For example, I've referenced the players score in the "My message" section.

Change "" to the app link, or whatever you fancy.

If your a bit lost after that, here's what mine looks like for GATE:

    "window.plugins.socialsharing.share('I just smashed my high score in [h2]GATE on hard mode with " & LastScoreFast & " points! [/h2]indiegame #raceto10k',
          '" & ScreenshotLink & "',
          '" & GameDownloadLink &"')"

Notice how I've referenced variables all throughout it. These can be used to create any changeable message.

Now this next part came from a bit of trial and error when I had a bug that sometimes didn't bring the share options up if they had already been dismissed. So, under the action we just made, add a new "Execute javascript" action with this as the code: "stop();"

All that's left to do in construct is to export! Simply export as cordova. Firstly though, reference the screenshot bellow to check it everything is correct:

This next section depends allot on what you are using to build your native app. I've personally used cordova for iOS and the Intel XDK for android. I should also note that I'm not going into details on this section as there are plenty more tutorials out there that do.

To add the plugin into cordova, head to the terminal and type "cordova plugin add

To add the plugin to the Intel XDK, head to "Project > Plugins" and under "Featured & Custom Cordova Plugins" scroll down to "SocialSharing*" and selected it.

That concludes the tutorial, hopefully you've managed to get it all working! Check out the video bellow for an example of it working on iOS.

Subscribe to Construct videos now

Thanks for reading and I hope I could help! If you want to support me, or just want a cool construct 2 game to play download GATE for iOS and



  • Order by
Want to leave a comment? Login or Register an account!