communication between cocos2d and native platforms

communication between cocos2d and native platforms
0.0 0



I guess this is a recurrent and probably unsolved question that is common in these forums. If we can explain how to communicate between cocos2dx, and for instance, Android features, or iOS features, we would be able to solve things like:

  • Facebook integration
  • Twitter integration
  • In-App purchases integration
  • And integration with any platform-specific framework (for instance OpenFeint).

If I develop an HTML5 app in Android, and want to get access to native features from Javascript, I can do it very easily communicating from javascript with the webview that contains it. I would be the happies man in earth if I could know if there is something similar in Cocos2D-X.




First you can use jni to communicate with Android feature, and you can mix use c/c++ to use iOS features.
Detail information please refer the implementation of CocosDenshion.

About the second question, i don’t know if js binding meets your need.
If so, you can refer testjs on gles2.0 branch.


Thanks, that was useful! If I get enough experience some day I’d like to write an article about this topic… I guess it’s really important and this importance is not reflected in the official documentation.