GameSalad & Cordova: Native Share

Posted by

If you have not read part 1, I would suggest you do since this will not make much sense otherwise.

  1. 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.
  2. Then in the command window add these two Cordova plugins. One is the sharing and other is the take screenshot plugin:
  3. 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.
  4. 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.

Simulator Screen Shot - iPhone 8 - 2020-04-10 at 17.40.40

Clicking on the button brings up the native share. Not much going on because the Apple simulator doesn’t have many apps installed.

Simulator Screen Shot - iPhone 8 - 2020-04-10 at 17.38.50

I ended up clicking on the Save Image button and the screenshot is saved to the photo library:

Simulator Screen Shot - iPhone 8 - 2020-04-10 at 17.40.59

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.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.