Maemo

From jalimo (inactive) Wiki
Revision as of 16:37, 14 January 2009 by Rschuster (Talk)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

This article describes, how to get started, if you want to install and use Jalimo on maemo based devices (e.g. n800, n810).

Currently we support Maemo 4 (Chinoook). Install this jalimo swt example, if you just want to see jalimo working on your device:


For serious development you should get developer access on your device. This means having ssh, become root and having an xterm. You can achieve this by following this Tutorial. If you just want to install and run pre packaged applications, this is not necessary, of course.

Contents

Install packages

Click this link with your InternetTable device to install Cacao and GNU Classpath. (Requires Red-Pill Mode in Application Manager) Alternatively you can read the detailed packages description for more information.

Hello World

public class HelloWorld {
	public static void main(String[] args) {
                System.out.println("Hello World");
	}
}

Compile this sample code with any java compiler. Copy the HelloWorld.class to your jalimo enabled device (e.g. using scp, or WinSCP on Windows) and call

cacao HelloWorld
See our svn for the full packaged source or install the example using this the single click installer and start it by jalimo-console-example in a shell.

SWT Sample application

import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.RowLayout;
import org.eclipse.swt.widgets.*;
 
public class SimpleSwtSample {
 
	public static void main(String[] args) {
		Display display = Display.getDefault();
		final Shell shell = new Shell(display);
		shell.setLayout(new RowLayout(SWT.VERTICAL));
 
		Label label = new Label(shell, SWT.CENTER);
		label.setText("Hello maemo");
 
		Button button = new Button(shell, SWT.NONE);
		button.setText("close");
		button.addListener(SWT.Selection, new Listener() {
			public void handleEvent(Event arg0) {
				shell.dispose();
			}
		});
 
		shell.open();
                while (!shell.isDisposed())
                  if (!display.readAndDispatch())
                    display.sleep();
	}
}

Compile this sample code against the Eclipse SWT libaries using any java compiler. You can get the libraries from the SWT Homepage for different platforms) . Run the application on your host. Copy the SimpleSwtSample.class to your jalimo enabled device (e.g. using scp, or WinSCP on Windows) and call

cacao -cp /usr/share/java/swt-gtk.jar SimpleSwtSample
You can find this and example together together with a slightly bigger one in our Subversion repository. This full example contains a complete packaging description and menu integration.


Debian packaging

Of course an application needs a proper packaging. For maemo this means packaging in debian (.deb) archives. The most java developers are not familiar with linux distribution integration. Therefore we have created a packaging plugin for apache maven (the defacto standard build system for java). To use this plugin, simply create a maven project and add the evolvis plugin repository, as well as the packaging configuration to your pom.xml. You can find an example here or in the above SWT example. After that, you simply have to run

mvn pkg:deb

in your project to get a suitable .deb archive. One of the benefits of the plugin is the capability to translate the maven dependencies to debian package dependencies.

To get a maemo menu entry for you application, simply create a proper .desktop file and add it to the resources description of the packaging plugin configuration, with the target location /usr/share/applications/hildon/. If you want your application to be installed by normal users using the maemo Application Manager, you should choose user/<SUBSECTION> as configured debian package section. See the Application Manager How To for further details.

Jalimo Maemo SDK, Scratchbox

To further simplify the development for maemo, we have assembled a Jalimo development package for the Scratchbox based Maemo SDKs.

Maemo and OpenEmbedded

Jalimo counts on Building with OpenEmbedded. But the jalimo packages for maemo are build using the official maemo SDKs, based on scratchbox, since OpenEmbedded does not fully support maemo.

To achieve the goal of a single build environment, for all of our target platforms, we are working towards a maemo support in OpenEmbedded. For the maemo 4 (chinook) we have an OpenEmbedded configuration in our OpenEmbedded overlay, which basically works. But there are some issues left, mainly in the package namings. If you are interested in the combination of OpenEmbedded and maemo you should give this a try and also check out the Mamona project.

Limitations

Limitations on Maemo 4.x

  • SWT lacks the HTML widget support
  • no support for extended (specialized) hildon widgets.
  • Java Preferences API is not provieded
  • small API coverage in java-gnome

Additions

Additions to SWT

Since SWT-GTK is geared towards plain desktop-based GTK some alterations where needed to make it look better on a Maemo device. The following things have been done:

  • the MenuBar is in fact the top-level hildon menu
  • all application windows (except dialogs) are "HildonWindow"s (for proper sizing and decoration)
  • instead of the GtkFileChooserDialog the HildonFileChooserDialog is used