Pass Score Variable to Facebook / Twitter Share Button

Pass Score Variable to Facebook / Twitter Share Button
0.0 0



For my desktop game, I’ve decided to use the sharebutton of both facebook and twitter within webview component which is more easy to implement. So my question is, how can i pass a score variable, so when a user press the tweet button, this score will be included in the tweet? Do I have to use **module.exports ?, and then include the .js? How can I go about doing this? Thanks and God Bless…




You can install a extension named SDKBox from the menu Extension->Extension Store…. The extension will help you to implement the features.

For more informations please take a look at the website of SDKBox. Hope it’s helpful!


Hi @luke2125 :slight_smile:

You can use Sonar Cocos Helper classes. Its simple and faster.

Just add those classes and you are good to go, you can share/tweet and even attach photo/screenshots as well.

You can refer this link :


Hi @zhangbin

Thanks for the info and help, yes, I’ve looked at SDKBOX, but I’m waiting for the plug-in to be out of beta for Cocos Creator… Also, right now, I’m trying to do it on the Web-Desktop, this is why I’m using a webview and using the share button sdk from facebook / twitter, which is more easy to implement, besides, I don’t think SDK supports web-desktop? Thanks for your help and courtesy…:slight_smile: God Bless…




Hi @AbhijeetVaidya

Thanks for info and help…:slight_smile: But I noticed that this is C++, can I still use this within Cocos Creator, after build then open in xcode / android studio? Thanks again for the help…God Bless…




Are you developing your app in js? or cpp?


Hi @AbhijeetVaidya

I’m developing using js, so I’m looking into implementing facebook and twitter sdk via IOS /Android through their editors ( xcode, android studio ), what I’m doing is building the game through Cocos Creator ( binary ), then opening the files in the editor, and from there, importing the facebook sdk as per below:

I wish there was an easy way about implementation of sdk, the other option is to wait for the sdkbox plug-in for Cocos Creator, which is still in beta… Thanks again and God Bless…




Hi @luke2125

I think they have classes for js, I’m not completely sure, but you can check out once. :slight_smile:


hi. i getting an error when using sonar cocos helper, when integrate facebook SDK, because the facebook sdk is updated


What kind of error.? Can you post it :confused:


Hi @AbhijeetVaidya

Yes, I’ve checked it out and tried it, but not go…I’ve downloaded the sdkbox gui which is still in BETA, and see how it goes…I’m just looking to implement facebook / twitter share buttons, they work okay via web component, which I’m using for the web desktop part of my game, but for mobile…It’s totally different…But let’s see…Thanks again and God Bless…




the facebook library used in the tutorial video was version 2.x.x, but me have version 4.x.x
so i was continue to go with version 4.x.x, but nothing happen when i run on my android device and click the button :frowning:
i was following the tutorial from start to begin with carefully.