How to run 'spacebrew' in “android mode” f

2019-07-29 08:52发布

I am making an andriod app using 'andriod for processing lib" of processing (ie. running android mode in processing 2.0.3 and lauching it on my device).

Spacebrew (http://docs.spacebrew.cc) is a easy to use web socket library for processing , also availabel as javascript.

if i run the spacebrew example codes in andriod mode, the app gets launched in my device but doesnt show up in my spacebrew admin. whereas if i run the same thing in my mac, it shows up correctly. guess the websocket communication is not happening while using "andriod for processing". But this is the easiest way to use web sockets. So can anyone help me figure out on how to make spacebrew work in processing (android mode)

this is for my college project. any suggestions on how to get this running please? thankyou in advance

1条回答
地球回转人心会变
2楼-- · 2019-07-29 09:33

Thanks for pointing me to Spacebrew, didn't know about that!

I've just tested it from Android Mode and it does work, but there is a tiny quirk you might be missing out: permissions!

Normally, if your app uses extra permissions, the application's manifest allows you to use these. In Processing, that's also possible via Android > Sketch Permissions and in the case of Spacebrew, INTERNET is the permission you need enabled, as you can see below:

Android Permissions in Processing

I just a did a test myself and it seems to work just fine with the amazon hosted demo: spacebrew button demo

Note that the Spacebrew Processing library uses the java websocket library, but only sets up a WsClient client. You can if you want use this jar in an Android SDK eclipse project and have your Android app act as a websockets server as well, not just a client (just in case this will become handy to you at some point in the future)

查看更多
登录 后发表回答