Facebook and Twitter Dialog for cocoonjs

1

Attached Files

The following files have been attached to this tutorial:

.capx

dialogfacebook.capx

Download now 179.43 KB

Stats

2,264 visits, 3,702 views

Tools

Translations

This tutorial hasn't been translated.

License

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.

Published on 18 Mar, 2014. Last updated 19 Feb, 2019

This is a solution that use facebook and twitter dialog with the browser plugin for publish your game score on ios windows phone and android using cocoonjs, it is a simple but useful solution I hope it works for you

if you only need to work with android yo can put the dialog url(facebook or tweeter) on a browser "OpenURL in a new window" action like this:

if you need this to work on iOS, you need to use something to encode the url, maybe you knows other solution this is what i found:

1. you can encode the url on an external tool search "encode url" on google and you will have a lot of tools for this.

or

2.you can use the encodeURI inside a plugin

a.Create a new plugin to use the encodeURI function of javascript or create a copy of browser plugion (if you create the copy yo need to change the id and name of the plugin

    	return {"name":			"Browser","id":			"Browser","version":		"1.0","description":	"Access the browser that is running the HTML5 application.","author":		"Scirra","help url":		"http://www.scirra.com/manual/110/browser","category":		"Web","type":			"object",			// not in layout"rotatable":	false,"flags":		pf_singleglobal};


)

b.add the encodeURL function to the brwoser plugin Open url function like this:

Be sure not to have any encode url on the facebook or twitter url

Complementary material

* You cand find the plugin code in C:\Program Files\Construct 2\exporters\html5\plugins\browser\runtime.js

* You can use tumblr to store your image

* Use this links to undestand more the properties of each dialog box

facebook reference

twitter reference

Dialog for facebook

facebook.com/dialog/feed Your score message here &link=https://developers.facebook.com/docs/dialogs/&redirect_uri=https://facebook.com&name=Your game name &picture=your picture url&description= your description

Dialog for twitter

twitter.com/intent/tweet Your score message here &lang= your lenguage &url=your url

.capx

I have attached a . capx to that show what i have done, remember to use the encodeURI function for iOS

.CAPX

dialogfacebook.capx

Download now 179.43 KB
  • 0 Comments

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