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.
Before we start writing the script for the custom message, head to: http://www.x-services.nl/phonegap-share-plugin-facebook-twitter-social-media/754 and read the documentation, this gives all the possible combinations.
Now we will add the content to the end of that code snippet. I used this example:
'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 "https://www.google.nl/images/srpr/logo4w.png" 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 "http://www.x-services.nl" 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.
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 github.com/EddyVerbruggen/SocialSharing-PhoneGap-Plugin.git%22.
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.
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