how to integrate facebook in cocos2d-x & is it possible ?

how to integrate facebook in cocos2d-x & is it possible ?
0.0 0


I’m currently working on a cross platform game for iOS and Android using cocos2d-x and it’s going really well, however I am struggling to find any way of integrating social networking / gaming functionality like Facebook. To make the game commercially viable it would be really beneficial to implement some kind of social gaming feature. Has anyone done this or could you point me in the right direction?


hi, did you finally integrate your game with Facebook? can share some thoughts? thanks! :slight_smile:


This might not count as ‘integration’ as such, but in my recent app I’m passing a call to Facebook to post on a user’s wall using a URL. A few topics posted lately discuss how to open a URL using JNI so I won’t get into it, but the URL I created is something like the following:'S_API_KEY_HERE&link= just played Your App!&redirect_uri=

If all works correctly, when launched this will open a browser or Facebook (if it’s installed) and the user will be prompted to sign in if they haven’t, and afterward they will be served up a standard Facebook post-to-wall dialog.

My game was a port of one I did in Objective-C, and this was the only functionality it needed. I hope that this helps you.



thanks. Cocos2dx should ideally provide a better way to integrate with Facebook. Today that is a mandatory feature for any game that pretends to be successful…


for android … JNI can be used …. i referred SimpleAudioEngine.cpp along with java files in cocos2d package, finally i can post on my wall , calling just a function from cpp and all facebook part is done in higher level java files. sorry for the english


next part coming soon. I hope it helps.


Well done! Thanks!
Looking forward when it will be put to cocos2d-x’s extensions :wink:


I can’t make an extension, I’m not an expert and it is not the best way to do it, as I suggest on the blog post. If somebody helps me to solve the issue of having to put the code in the appdelegate I might do it.





is it possible to integrate Facebook with cocos2d-x in a Android application?

I have tried to do using JNI but I did not success… anyone has any clue or code example to share?

Thank you very much!


Jesus Bosch wrote:
next part coming soon. I hope it helps.

Hi the link seems to be not working… could you provide and alternate link? thanks.


I think the cocos team has just released a plugin for FB on JS-bindings. I’m not sure if it can be used on C++ projects, would be good to know