If you have not read part 1, I would suggest you do since this will not make much sense otherwise.
- Navigate in the command line to the folder where your project is created. The easiest way for me is to type “cd” and then drag the folder icon at the top of the folder into the command window.
- Then in the command window add these two Cordova plugins. One is the sharing and other is the take screenshot plugin:
cordova plugin add fitatu-cordova-plugin-x-socialsharing
cordova plugin add cordova plugin add https://github.com/gitawego/cordova-screenshot.git
- Back to our integration file cordova-app.js. I first take a screenshot of the screen and then I send it to the social sharing plugin. I use the onTweetSheet callback of the GameSalad engine. The code is very much a copy-and-paste from the two plugin pages. I have attached the entire cordova-app.js for convenience.
- On the GameSalad side, I added a button that fires the onTweetSheet behavior.
The screenshot of the game running with the new button. The second round button on the bottom left.
Clicking on the button brings up the native share. Not much going on because the Apple simulator doesn’t have many apps installed.
I ended up clicking on the Save Image button and the screenshot is saved to the photo library:
That is all for today, let me know if you have any questions. I am not sure what I should do for tomorrow, but I’ll come up with something.