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


#1

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


#2

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?


#3

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.


#4

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


#5

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


#6

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.


#7

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.


#8

@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?


#9

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/