Vertx embedded in Android App + In App Module Deployment for Large Sensor Networks

2,137 views
Skip to first unread message

Oliver Rolle

unread,
Dec 5, 2013, 12:34:52 PM12/5/13
to ve...@googlegroups.com
Hi Community,

In my master thesis I want to use vertx in embedded devices / android smartphones. Why I want to use vertx is, because I like to code in/for vertx and I am in a kind of love relationship with it - and I hate android api. My use case:

Use Case
Environment is a big question in cities - not only in developed countries. The current method of measuring environment is to deploy expensive sensor stations (like weather stations) in central places in a city. But to measure noise pollution I need many more sensor stations for an accurate picture. The idea of my professor is to use low cost sensor platforms - like older smartphones (microphone = measure noise level) and distribute many of them all over the city (in street lights or in cars). The smartphones have many communication interfaces (WLAN, 3G, Bluetooth, NFC) for sensor data routing. The nice thing about vertx is its resourcefulness, communication orientation and deployment. Its useful in multiple ways: (1) not much resource on an older smart phone, (2) may different network interfaces on a smart phone (event bus as an abstraction for these interfaces), (3) test different mobile sensor network implementations and noise models (sound level, frequencies, nature vs artificial noise) through hot deployment in the living  system, (4) polyglot for ease of development for future students. A resulting vertx deployment / android app is written for embedded devices, so no UI stuff is needed in the first place.

1. Would the vertx solution preferable over androids native API in terms of flexibility and manageability for large embedded deployments?
2. Will it be expensive to write an Android compatible version of vertx core & platform?
3. I have to wrap most of android sensor APIs in single/multiple vertx modules.
 a) Would you use such modules for writing embedded software?
 b) Is it possible to distribute vertx modules which reference on jar libraries only available in the android classpathes? Think of android.location.* for GPS / Network localization. If one device supports a new API for Localization eg. Galileo (Europeans GPS), I want only to have to write 1 new module and distribute it for all supporting devices in my large scale deployment.

best regards
Oli

Mumuney Abdlquadri

unread,
Dec 5, 2013, 1:57:57 PM12/5/13
to ve...@googlegroups.com

Hi,

Vertx requires java 1.7 which is not available on android.

Vertx use NIO unless there is an equivalent API in android writing core or platform is near impossible.

I will sugest you use raspberry pi. Install vertx on it and you are good.

You can attach whatever sensor you need.

My view.

Rgd

> --
> You received this message because you are subscribed to the Google Groups "vert.x" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to vertx+un...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.

Norman Maurer

unread,
Dec 5, 2013, 2:22:28 PM12/5/13
to ve...@googlegroups.com, Mumuney Abdlquadri
And NIO on android is also very buggy. So I think no…

-- 
Norman Maurer

Mumuney Abdlquadri

unread,
Dec 5, 2013, 2:42:07 PM12/5/13
to ve...@googlegroups.com

Another option is to bridge the event bus to java client and wrap that as jar in your android app. I suspect a java websocket lib will be needed.

I have wanted to do this for long. But little time.

Or use the provided javascript eventbus bridge in an HTML5 app. Wrap it in apk using phonegap. I guess this is not acceptable due to your use case.

On Dec 5, 2013 6:34 PM, "Oliver Rolle" <oliver...@googlemail.com> wrote:

Oliver Rolle

unread,
Dec 5, 2013, 5:51:39 PM12/5/13
to ve...@googlegroups.com
I see! that is really bad!
The alternative is managing threads in android myself - horrible!
I want module deployment without being at the devices, local event bus for module decoupling and async programming style for ease of use.

> Another option is to bridge the event bus to java client and wrap that as jar in your android app. I suspect a java websocket lib will be needed.
I looked at https://github.com/koush/AndroidAsync/ which uses 1 Thread with a Queue to emulate async behaviour and supports websocket client + server. If I add a very simple local event bus (implements Vertx Eventbus Interface) and a simple module deployment (implements Vertx Container Interface; No idea how to do that), than it should be near enough to write android apps with a minimal vertx api?


> I will sugest you use raspberry pi. Install vertx on it and you are good.
Not an option because we want to scale. We used raspberry pi + sensors, but in a 30+ nodes outdoor config the maintenance is extremely expensive. Smart phones are more robust and cheaper (we buy old models for 1-10$).

best regards
Oli

Ken Yee

unread,
Dec 5, 2013, 9:35:07 PM12/5/13
to ve...@googlegroups.com


On Thursday, December 5, 2013 5:51:39 PM UTC-5, Oliver Rolle wrote:
I want module deployment without being at the devices, local event bus for module decoupling and async programming style for ease of use.

For an event bus, look at RoboGuice and Otto among others.
You also probably want to look at message queues.

Oliver Rolle

unread,
Dec 8, 2013, 9:45:45 AM12/8/13
to ve...@googlegroups.com
thx for the recommendations. RoboGuice and Otto are based on Androids Intent's ((Type-based pub/sub)), which is not practically for my use case - I want a topic based pub/sub, because extentions/plugins/modules are loaded at runtime, not knowing the Types (or Classes) of messages at compilation time. I try Asper (Esper on Android), which is a CEP based on Java-Maps.

田传武

unread,
Dec 8, 2013, 9:19:02 PM12/8/13
to ve...@googlegroups.com
I've written a java eventbus client over sockjs's raw WebSocket using Java-WebSocket, and also works on android.

Source: 
Test case: 

The code is not completed and may have compiling errors, however, you can find the working jar at sonatype oss maven repository, put this in your pom.xml to use it:

<repositories>
  <repository>
    <id>sonatype-nexus-snapshots</id>
    <name>Sonatype Nexus Snapshots</name>
    <url>https://oss.sonatype.org/content/repositories/snapshots</url>
    <releases>
      <enabled>false</enabled>
    </releases>
    <snapshots>
      <enabled>true</enabled>
    </snapshots>
  </repository>
  <repository>
    <id>goodow-realtime</id>
    <name>Goodow Realtime Maven Repository</name>
    <url>https://raw.github.com/goodow/maven/master/repositories/realtime/</url>
    <snapshots>
      <enabled>false</enabled>
    </snapshots>
  </repository>
</repositories>

<dependency>
  <groupId>com.goodow.realtime</groupId>
  <artifactId>realtime-android</artifactId>
  <version>0.5.0-SNAPSHOT</version>
</dependency>



Mumuney Abdlquadri

unread,
Dec 9, 2013, 1:21:33 AM12/9/13
to ve...@googlegroups.com

Hey i,

This is awesome will check it out once I am with my computer.

Thanks a lot.

Rgds

Reply all
Reply to author
Forward
0 new messages