MobileImageViewer Reference Application on the Basis of Several Mobile Application Development Platforms

Introduction Mobile Devices cannot be imagined as not existing in today’s heavy connected world. The right information for the “right” user shall be provided at the right time, at the right place. Therefore context sensitive applications have to be developed, able to customize themselves (semi-) automatically according to the users’ needs.

Since the devices are strongly heterogeneous there are many different platforms for application development. For example there are Symbian OS1 with Java Micro Edition (JavaME), Windows Mobile2 and the .Net Compact Framework, or Android3. All these platforms are different with respect to their functions, application programming interfaces/libraries provided for the application developer.

This short guide will help you to get introduced to the main aspects of application development by means of the platforms mentioned above with the help of an example application realised for all those platforms.

The reference application called “MobileImageViewer” is, like the name supposes, a kind of picture viewer for mobile devices, but in a client-server-architecture. Therefore, the application consists of two parts: a server-side part and a client-side part. The server is used as picture repository and provides a interface that can be used for retrieving the pictures. Besides the pictures meta information, like size or some tags, are stored at the server. Also an organization within collections is possible.

The client applications on the mobiles devices use this interface browsing the picture archive, obtaining the pictures and manipulating the meta information via the Web Service interface needing an arbitrary network connection. Dependent on its capabilities, resources and connectivity each client can specify the parameters of service call, for instance to adjust the thumbnail and image size to resources and user needs. In addition, client side mechanisms like caching of thumbnails are used to improve the application behaviour on mobile devices.

The following picture shows the architecture of the reference application.

1 The Symbian Foundation Community (http://www.symbian.org/) 2 Windows Mobile (http://en.wikipedia.org/wiki/Windows_Mobile) 3 Android Developers (http://developer.android.com/index.html) 1

Besides this document, the source code of the different application implementations can be obtained at the website of the lecture. Especially there are some *.zip archives containing the following:

• WebService – Web Service implementation for the server • Android – client implementation for Android clients • NETCF – client implementation for Windows Mobile clients using .NET Compact Framework • JavaME – client implementation for JavaME capable clients

In the following the different parts and implementations of the reference application are discussed in detail. That is the development environments and needed steps to get the example applications running are described.

Web Service at the server As already mentioned the Web Service at the server acts as a service provider for the clients, providing functions for listing and retrieving the stored pictures and their meta information.

In detail the Web Service provides the following interface:

return type method PictureItem[] getPictureItemList() PictureInfo getPictureProperties(long picture_id) GeoInfo getPictureGeoProperties(long picture_id) String getPictureURL(long picture_id) String getPictureThumbURL(long picture_id, int width, int height) boolean addPictureTag(long picture_id, String tag) boolean removePictureTag(long picture_id, String tag) boolean setPictureCollectionName(long picture_id, String name) PictureItem[] getPicturesByCollection(String name) String[] getCollectionNames() boolean setPictureName(long picture_id, String picturename)

The Web Service was developed via Eclipse 3.4.2 for Java EE Developers 4and Apache Axis 25. The runtime environment used was 6.0.186.

A general introduction to the development of Web Services with the aid of eclipse and apache axis can be found on http://www.eclipse.org/webtools/community/tutorials/BottomUpAxis2WebService/bu_tutorial.html

In our case the main implementation of the picture archive resides in the class pictureserver.service.PictureArchiveService. It contains the implementation of all methods for listing and retrieving the pictures or modifying the meta information stored at the server.

4 Eclipse (http://www.eclipse.org/) 5 Apache Axis 2 (http://ws.apache.org/axis2/) 6 Apache Tomcat (http://tomcat.apache.org/index.html) 2 Every picture within the repository is represented as a pictureserver.types.Picture. Meta information about the pictures are extracted and stored in pictureserver.types.PictureInfo and pictureserver.types.GeoInfo objects. To get the already implemented service up and running you have to do the following steps: Install Eclipse for Java EE Developers7. Install Apache Tomcat8. Download the binary distribution of Apache Axis 29. Extract the downloaded Apache Axis distribution to an own folder. Open Eclipse  Window  Preferences  Web Services  Axis2 Preferences and specify the path you extracted the files to in step four. Download the WebService.zip from the webpage of the lecture, extract it and import the project into Eclipse. Start the Web Service by right-clicking the project PictureArchive and select “Run As”  “Run on Server”. After a successful start you should see the following webpage in your web browser.

Android client implementation The Android client application was developed by means of Android SDK for Android 1.6 Platform10.

A general introduction to the application development with Android can be found on the following webpages and books:

Android Developers – The Developer’s Guide http://developer.android.com/guide/index.html Android – Grundlagen und Programmierung von Arno Becker und Marcus Pant http://www.dpunkt.de/ebooks_pdf/free/3436.pdf

Our Android project consists of three java packages: picturearchive.views, picturearchive.proxy, picturearchive.helper. The classes of the package views are the activities representing the different views of the application. The package proxy contains all classes that are used for communication with the Web Service described above. The package helper contains classes for the local storage of thumbnails already downloaded and properties specified by the user.

7 Eclipse (http://www.eclipse.org/) 8 Apache Tomcat (http://tomcat.apache.org/index.html) 9 Apache Axis http://ws.apache.org/axis2/download/1_5_1/download.cgi 10 Android SDK (http://developer.android.com/sdk/index.html) 3 To get the implemented application up and running you have to follow these steps: Install Eclipse for Java EE Developers8. Install the Android SDK11. Download the Android.zip from the webpage of the lecture, extract it and import the project into Eclipse. If the project causes the problem “The type R is already defined” right-click the project, select Properties  Builders and deselect the “Java Builder”. Start the application by right-clicking the project and selecting “Run As”  “Android Application”

The figure shows some screenshots of the running application.

Windows Mobile client implementation The Windows Mobile client implementation was developed with the aid of Windows Mobile 5.0 Pocket PC SDK11 and Visual Studio 2005. It uses the Microsoft .NET Compact Framework 2.012.

A general introduction to the application development of Windows Mobile applications by means of .NET Compact Framework can be found on the following webpages and books:

Getting started with .NET Compact Frameworks development http://www.danielmoth.com/Blog/Getting-Started-With-NET-Compact-Framework- Development.aspx Programmieren mit dem .NET Compact Framework von Dröge, Weber, Nowak (Microsoft Press, 2006, available at the SLUB Dresden)

Our Windows Mobile client project map contains the Windows Forms representing the different views of the application, some helper classes and the application resources. Using the references prefabricated classes, e.g. for XML processing, are imported. The Web Service is imported as “Web Reference”.

11 Windows Mobile 5.0 Pocket PC SDK (http://www.microsoft.com/downloads/en/confirmation.aspx?FamilyID=83a52af2-f524-4ec5-9155- 717cbe5d25ed) 12 Microsoft .NET Compact Framework (http://msdn.microsoft.com/en-us/library/f44bbwa1) 4 To get the implemented application up and running you have to follow these steps: Install Visual Studio .NET 2005. Install the Windows Mobile 5.0 Pocket PC SDK. Download the NETCF.zip from the webpage of the lecture and extract it. Open the project file PictureArchiveNETCF.sln by double-clicking it. Later on open it by clicking on “Recent used Projects” in Visual Studio. There seems to be a funky difference against this way and the “normal” one. Press F5 to get the application started. Select “Pocket PC 2003 SE-Emulator” and wait until the emulator appears and the application has started. Do the following steps in Visual Studio: “Extras”  “Emulated Device Manager”  right-click “Pocket PC 2003 SE-Emulator”  select “in cradle” Press the “Windows-Button” on the Emulator and select “Settings” from the start menu. Select the tab “Connections” and the icon “Connections”. Select “Advanced” and push the button “Select Networks”. Choose “Company Network” in both Lists. Close all the dialogs with “OK” until you see the MobileImageViewer application again. Do in the Emulator Window the following: “Datei”  “Konfigurieren…”  Netzwerk  select “NE2000-PCMCIA-Netzwerkadapter aktivieren und binden an:”  “OK” Open the settings dialog of the MobileImageViewer application by pressing “Settings” Modify the IP address of the URL to the IP address of you local (host) pc where the emulator is running on. Save the new configuration by pressing “save”.

JavaME client implementation The JavaME client implementation was developed via Sun Java Wireless Toolkit 2.5.2 for CLDC. The successor of this toolkit is the Java Platform Micro Edition Software Development Kit 3.013. NetBeans IDE 6.514 was used as development environment.

A general introduction about application development can be found at the following webpages:

13 Java Platform Micro Edition Software Development Kit 3.0 (http://www.oracle.com/technetwork/java/javame/downloads/sdk30-jsp-139759.html) 14 NetBeans (http://netbeans.org/) 5 J2ME Tutorial – Learn J2ME http://www.j2mesalsa.com/elearning/index.html SUN J2ME Tutorial http://today.java.net/pub/a/today/2005/02/09/j2me1.html J2ME Tutorial der FH Ostschweiz http://www.bstuder.ch/sppmc/v20_Tutorial_J2ME_ohne_loe.pdf

Our implementation of the JavaME client consists of the packages picturearchive.gui, picturearchive.net and picturearchive.proxy. The main part of the application functionality is implemented in the class picturearchive.gui.PictureArchiveJ2MEClient. For loading and displaying the pictures the classes picturearchive.gui.ViewCanvas, picturearchive.gui.WaitForm and picturearchive.net.NetWorker are used. To get the implementation up and running follow these steps: Install NetBeans IDE15. Install the “Wireless Toolkit 2.5.2 for Windows” over Extras  Plugins. Download the JavaME.zip from the webpage of the lecture and extract it. Open the Project in NetBeans. Run the project by right-clicking on it and selecting “Run with”. You have to choose as platform “Sun Java (TM) Wireless Toolkit 2.5.2 for CLDC” and as device “DefaultColorPhone”.

Acknowledgement The MobileImageViewer project was created by René Dienel during his student thesis (Belegarbeit). The project and document was prepared for the course “Application Development of Mobile and Ubiquitous Computing” by Franz Josef Grüneberger.

15 NetBeans (http://netbeans.org/) 6