Using a JS-Binding (custom, manual) in Android project

Hi,

I’ve written a manual JS-Binding. Testing was done using XCode everything works pretty well.

Now I just thought I would like to see if it’s running on android. I’ve tried to compile my Project, which uses the binding, for Android and it complains a undefined reference to my binding when I use it at AppDelegate.cpp (which works pretty well on XCode).
How do I have to setup my Eclipse (ADT) for using custom bindings (located in scripting/javascript/bindings) in my project?

Thanks in advance!

— Carsten Sandtner

Thanks, I saw your PR (https://github.com/cocos2d/cocos2d-x/pull/2561).
But I haven’t seen any changes in Android.mk and xcode project files.
Could you also update the TestJavascript project configuration for testing this functionality?
And one quick question: Why not to use bindings-generator to generate jsbinding glue codes?

How do I have to setup my Eclipse (ADT) for using custom bindings (located in scripting/javascript/bindings) in my project?

You have to update the cocos2d-x\scripting\javascript\bindings\Android.mk file to compile the codes you added.

James Chen wrote:

> How do I have to setup my Eclipse (ADT) for using custom bindings (located in scripting/javascript/bindings) in my project?
>
You have to update the cocos2d-xscriptingjavascriptindingsAndroid.mk file to compile the codes you added.

Thanks now I got it! Regarding TestJavascript Project: Could you point me where I could find this project.

— Carsten Sandtner

@Carsten S
Did you want to find Android.mk of TestJavascript?
If so, you can find it in samples/Javascript/TestJavascript/proj.android/jni.

When does you merge the patch to master, we wait for this feature so long time…

Minggo Zhang wrote:

@Carsten S
Did you want to find Android.mk of TestJavascript?
If so, you can find it in samples/Javascript/TestJavascript/proj.android/jni.

Thanks for accepting the Pull Request and even more thanks for checking and cleaning up my Code as I am not a day-by-day C++ developer and I was sure it needs some improvements.

@Carsten S
That’s all right. BTW, do you have some ideas about the implementation of WebSocket in JSB? I’m trying to achieve it based on https://github.com/akira-cn/cocos2dx-cqwrap.
Any suggestions?

Hmm. Websockets are a bit different. You rely on a permanent Connection. Means you open one Connection and keep it open until you stop the App/the Game. Maybe it is also possible using CChttp as it needs to be threaded. The XMLHttpRequest has been implemented while reading the W3C spec and implementing function which behave at least minimal like the spec. Maybe the same works with websockets: http://www.w3.org/TR/2011/WD-websockets-20110929/