Storyboard IO with Android?

All things Storyboard for the Android platform.

Moderator: jamiev

Storyboard IO with Android?

Postby jimpanse » Mon Mar 17, 2014 8:11 am

Hey,

is it possible to run the storyboard_io example (see the picture below) with the cluster_update.c program on an Android device?
How can events be sent to an Storyboard Android Application? Do I need an Android Service that sends the events to the App? How is this realized?

io_example.png
io_example.png (143.9 KiB) Viewed 28175 times


Thanks in advance!
jimpanse
 
Posts: 5
Joined: Mon Mar 17, 2014 7:54 am

Re: Storyboard IO with Android?

Postby DarkWishMaster » Mon Mar 17, 2014 8:41 am

I don't know how it can be done, but what I know is that you can write programs and services (basically classes)
for android in java and then use that classes directly in your crank app, via lua script. Check out the forum,
there was posts about how it can be done.
And then, you'll get the same effect just by periodical calling a script which will check the event status returned from java for example.
DarkWishMaster
 
Posts: 47
Joined: Wed Oct 23, 2013 6:23 am

Re: Storyboard IO with Android?

Postby jimpanse » Mon Mar 17, 2014 11:03 am

Thanks for your answer. I'll try this next.

My idea was to export the storyboard_io sample to android, and send the events from another android app (ClusterUpdateApp). The ClusterUpdateApp loads the libgreio.so via the android ndk and calls the functions to open the channel and send the data (gre_io_open, gre_io_serialize, gre_io_send). I think I managed to get the ClusterUpdateApp running but the problem is at the exported storyboard_io app.
I exported the storyboard_io sample as an android application. I wonder how to set the greio channel name in the android export wizard.
In the storyboard simulator this can be done by clicking on the "libgre-plugin-greio.dll" entry and adding the channel name. An other option is to add the line "-ogreio,channel=cluster" to the storyboard runtime options. Both works for the simulator.
In the android export wizard the first option is missing. Adding the line "-ogreio,channel=cluster" to the storyboard runtime options in the export wizard has no effect I think. The problem is, that the greio plugin is not loaded by the app. In the logcat output of the app compared to the output of the storyboard simulator, these lines are missing:
INFO (0):Initialize plugin 9: [greio (3.2.0.12243)] [channel=cluster]
INFO (0):GREIO receiver registered @ [cluster]

The complete LogCat output of my exported app you can find here: http://pastebin.com/77uL6YGd

Any suggestions? Maybe a staff member of cranksoftware can help here?

Thanks a lot!!
jimpanse
 
Posts: 5
Joined: Mon Mar 17, 2014 7:54 am

Re: Storyboard IO with Android?

Postby mlove » Tue Mar 18, 2014 8:59 am

Unfortunately SBIO doesn't work the same on Android as other platforms. On Android the SBIO plugin stores messages in an in-memory message queue. That message queue is only accessible within the app. In order to use this we have to write a custom launcher to spawn new threads to do work and have them communicate to the UI thread via SBIO. Inter application communication isn't possible using this method. However, on Android we have access to it's java APIs using LuaJava, so it's possible to use another method of ipc that Android provides.
mlove
 
Posts: 22
Joined: Tue Apr 17, 2012 1:26 pm

Re: Storyboard IO with Android?

Postby jimpanse » Thu Mar 20, 2014 8:46 am

Thanks a lot guys. The storyboard io example is running now.

I wrote a Java class which implements a handler. This handler receives messages from another app and stores them in an ArrayDeque. I exported this class to a Java library and converted it like the example here: viewtopic.php?f=9&t=362
In LUA I call a method periodically which grabs the first message from the ArrayDeque and deletes it. By this I get all messages to the storyboard.

But I don't like the polling mechanism here. Is it possible to implement the handler in LUA so that the messages are pushed to the storyboard?
jimpanse
 
Posts: 5
Joined: Mon Mar 17, 2014 7:54 am

Re: Storyboard IO with Android?

Postby mlove » Fri Mar 21, 2014 8:12 am

Have you taken a look at LuaJava's createProxy function? It's supposed to be used as a way to implement a java interface or provide a set of callbacks that call back into lua functions. Unfortunately I don't have a working example of this functionality.

- Matt L
mlove
 
Posts: 22
Joined: Tue Apr 17, 2012 1:26 pm

Re: Storyboard IO with Android?

Postby jimpanse » Mon Mar 24, 2014 4:03 am

Thank you! This looks very promising.
jimpanse
 
Posts: 5
Joined: Mon Mar 17, 2014 7:54 am

Re: Storyboard IO with Android?

Postby jimpanse » Wed Jul 02, 2014 10:09 am

Hey, I'm back after a long time. Now I want to use the createProxy function.

The problem is, that my self-designed interface is not found by the createProxy funtion! I get this error:
LUA script failure (entry function: createmsgreceiver): java.lang.NoClassDefFoundError: com/me/MyInterface
The class file is located in the converted library that is inside the crank project.

Even with your sample code from the documentation of the createProxy function it doesn't work:
LUA script failure (entry function: createmsgreceiver): java.lang.NoClassDefFoundError: java/awt/ActionListener
But this example confuses me anyway because the "java.awt" package is not part of the Android API?!

Can you help me out? It would be great if I can get this createProxy thing start rolling!

Thanks!!
jimpanse
 
Posts: 5
Joined: Mon Mar 17, 2014 7:54 am

Re: Storyboard IO with Android?

Postby thomas » Mon Aug 25, 2014 2:56 pm

Hi,

The proxy example was taken from the original documentation for the LuaJava project. We will change out that sample and apply a more Android
relevant sample in the next documentation update.

In the meantime if you are having invoking your own classes, you can send your project to support@cranksoftware.com and we can take a look at
what you are doing to understand better what is going on and get to the bottom of the issue.

Thanks,
Thomas
thomas
 
Posts: 132
Joined: Mon Nov 02, 2009 4:32 pm
Location: Ottawa


Return to Storyboard for Android

Who is online

Users browsing this forum: No registered users and 1 guest

cron