How to run 'spacebrew' in “android mode” from processing?

旧街凉风 提交于 2020-01-06 01:55:09

问题


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:


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:

I just a did a test myself and it seems to work just fine with the amazon hosted 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)



来源:https://stackoverflow.com/questions/24989453/how-to-run-spacebrew-in-android-mode-from-processing

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!