opensource.luminis.net
 

Creating a dynamic OSGi application on Android

Update
A new community is launched around running Apache Felix an Android: EZdroid community

Description

As an example of how to create a dynamic, OSGi based application for Android, we have ported the "paint program" from the Apache Felix website.

Design

We chose the service based example as our basis. The first thing we had to do was create an Android application that contains Felix. Within that application we defined an Activity that is registered within Android and forms the starting point for any bundle that wants to display a user interface. A ViewFactory interface, containing a create() method is used, applying the whiteboard pattern, to contribute a new view. Our example currently supports only one such view at a time, but it would not be too hard to show different views in tabs, create a desktop with icons for each view, or even create some OpenGL based coverflow like front end.

To allow easy deployment, we included a copy of the freshly contributed FileInstall. That way we can simply copy bundles onto the device to deploy them, creating a very simple management agent.

Next step was the creation of a host bundle that contributes a view with a toolbar at the top and a canvas below. Because Android uses its own graphics library, we could not directly use the Swing and Java2D based API present in the original sample, but we used the same concepts.

Finally we created bundles that contributed individual shapes to the application: circle, triangle and square. The diagram below shows this design:

Usage

To be able to compile and run these examples, you need at least the M5 release of the Android SDK as well as the Eclipse plugin.

You can checkout the following Eclipse projects:

The projects use Ant build files to package bundles and deploy them to the right directory on the emulator. You need to modify your path to "android.home" to match the location where you installed the SDK and the emulator should be running already to deploy bundles.

Downloads

Authors

License

Apache License 2.0

Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.
  1. May 14, 2009

    Anonymous says:

    the svn checkout doesn't work. can you please fix that? Error: $ svn co https:...

    the svn checkout doesn't work. can you please fix that?

    Error:

    $ svn co https://opensource.luminis.net/subversion/oss/projects/osgi-android/trunk/net.luminis.android.felix/
    Error validating server certificate for 'https://opensource.luminis.net:443':

    • The certificate is not issued by a trusted authority. Use the
      fingerprint to validate the certificate manually!
      Certificate information:
    • Hostname: opensource.luminis.net
    • Valid: from Wed, 09 Jul 2008 23:00:00 GMT until Wed, 26 Oct 2011 22:59:59 GMT
    • Issuer: www.digicert.com, DigiCert Inc, US
    • Fingerprint: 3e:2b:eb:42:3e:35:7a:08:71:d6:57:9e:d1:87:e5:b7:65:cb:4a:45
      (R)eject, accept (t)emporarily or accept (p)ermanently? t
      svn: PROPFIND request failed on '/subversion/oss/projects/osgi-android/trunk/net.luminis.android.felix'
      svn: PROPFIND of '/subversion/oss/projects/osgi-android/trunk/net.luminis.android.felix': 501 Method PROPFIND is not defined in RFC 2068 and is not supported by the Servlet API (https://opensource.luminis.net)
    1. May 18, 2009

      Arjan Schaaf says:

      Sorry for that, the URL's were incorrect. The right path is: https://opensource....
  2. Sep 14, 2009

    Anonymous says:

    hello, I've downloaded the projects from the repositories and some projects lik...

    hello,

    I've downloaded the projects from the repositories and some projects like net.luminis.android.apachecon.felix, net.luminis.android.servicebased.circle, net.luminis.android.servicebase.triangle works fine and there are no problem with them. The projects
    net.luminis.android.servicebased.square and net.luminis.android.servicebased.host show some errors in the manifest.mf saying "no available bunble export package" and in the net.luminis.android.servicebased.host there is an error in the activator file "the import android.view.UIThreatUtilities" cannot be resolved.
    I would appreciate if you can help me with those errors please.

    Best regards!

    my email is: ryoussefi(at)gmail.com

    1. Sep 16, 2009

      Marcel Offermans says:

      Those errors can be safely ignored. Eclipse has problems understanding projects ...

      Those errors can be safely ignored. Eclipse has problems understanding projects that are both OSGi bundles and Android projects. I'm sure there is a solution for that, but I did not invest the time to find it. It works right now though.

  3. May 10

    Anonymous says:

    I can't get the program to work. Neither at the emulator (in every version) nor ...

    I can't get the program to work.
    Neither at the emulator (in every version) nor at my Android 2.1 Phone.
    After starting the application all I will get is a black screen, no mather how long a wait.

    I tried also to manually dex the felix jar's, but the dalvikvm couldn't find the Main-Class.

    Could you give any support or are there any known problems with never releases of the Android-JDK?

Add Comment


Powered by JIRA Studio 2.2 | Terms of Use | Bug/feature request | Request Support | Help/Documentation