Showing posts with label titan. Show all posts
Showing posts with label titan. Show all posts

Friday, September 5, 2008

Rich Internet MobileNet Applications

Introduction

Using AJAX-style user interface for OSGi-based applications is not a new idea. We even saw this concept on mobile devices, for example in an OSGi demo at Java One in 2007. The Rich MobileNet Application (RMA) concept takes these ideas several steps further and generalizes them to other UI technologies as well. The concept was first introduced in the OSGi Community Event 2008 in a presentation by Jon Bostrom. RMAs are an important new feature of Sprint Titan Platform. But what exactly RMAs are?

Motives

Rich Internet applications (RIAs) are web applications that have the features and functionality of traditional desktop applications. RIAs typically transfer the processing necessary for the user interface to the web client but keep the bulk of the data (i.e., maintaining the state of the program, the data, etc.) back on the application server.

Rich MobileNet Applications are the mobile extensions of Rich Internet Applications. Though many ideas used in RIAs are applicable and beneficial in mobile environments, there are mobile specific aspects that need to be taken into consideration when creating an application for mobile:

  • Connection Model: as opposed to RIAs, mobile applications should function in an occasionally connected environment. Access to the Internet may be available, may be limited or may not be present at all. For better user experience and improved usability, applications have to be prepared both in on-line and off-line mode, they may need to be able to synchronize data stored on the device with a backend when getting online, and be ready to use the local data store when the connection is not available.
  • Integration to Phone functions: applications designed for mobile devices should take advantage of mobility. Therefore, they need to be able to access the specific functions of the underlying device, such as call control, position, messaging or PIM.
  • Task flow, task focus: mobile applications have to prepare for mobile-specific events (for example incoming calls)
  • One hand operation: mobile applications should prepare for the limited input capabilities of the device and should be easily usable with one hand.
  • Touch: RMAs should be able to utilize the touch capabilities of the device, however they should also be prepared to operate without touch support as many devices do not have touch UI at the moment.
  • UI design: Device displays are lot smaller than PC screens. Additionally, the screen size and resolution may vary in a wide spectrum between devices. Some devices have multiple displays and the user may switch between them while using the application. Mobile applications should be prepared to such variances and be able to adapt to the device UI capabilities flexibly.
  • Code loading: RIAs are typically loaded over the Internet at start up. Though this approach has advantages in lower maintenance costs – no need to reinstall application at update – it makes the application dependent on Internet access. Mobile applications have to operate in an occasionally connected environment; therefore, it must be possible to install applications to a device locally.
  • Security: Accessing mobile-specific functionality is an important opportunity for mobile application, but they represent a big risk for the security and privacy of the device user. Additionally, mobile devices are subject to different kinds of attacks than PCs. For example, they operate in a changing network environment – due to mobility and roaming – and they are much easier to steal or lose. Therefore, the security measures applied in mobile applications and the underlying platform need to address these new threats as well.

If an application doesn’t handle these aspects properly, the result may be limited or no usability and poor user experience. Rich MobileNet Applications (RMAs) are the mobile extensions of Rich Internet Applications. Though building on technologies used in RIAs and benefiting from their advantages – like platform independence – they utilize mobile-specific solutions that enable the optimization of user experience for mobile devices.

So, what is an RMA?

An RMA consists of a renderable UI – HTML/CSS, JavaScript, Flash Lite etc – that is executing in the corresponding container and which can access the services running in OSGi Service Platform. These services can be generic-purpose services, shared by multiple applications or they can be application-specific, which allow implementing the computation-intensive business logic of the application in Java, utilizing the full power of CDC JVM and the OSGi Framework on top.

RMA Architecture in Titan Platform

Using CDC Java enables access to device functions (messaging, positioning, call control, PIM etc.) and platform services like file system, networking or even a database. Using Java security, a fine-grained access control of these resources is implemented.

Mobile OSGi provides the platform to develop applications from components (shared or application specific) and it enables the management of these components both locally and for a remote administrator. Using the local management capabilities and OSGi dependency management, missing components can be loaded on demand.

Using HTML or Flash as UI technologies enables a high level of portability with rich user experience. However, probably an even more important aspect is that these technologies are currently used for Internet applications. They have established patterns and solutions for most typical tasks, there are frameworks supporting web application development. RMA enables to take these into use in mobile applications.

The communication between the UI runtime and the OSGi Service Platform uses some HTTP-based remote access protocol like SOAP or JSON RPC. OSGi is an ideal platform for this with its servlet container implementation known as the HTTP Service. The Service Platform provides a mechanism that automatically exposes the available services through the supported protocols. It also provides a service registry where RMAs can find and bind the available services. These automatic mechanisms make the creation of services simple and straightforward, the service developers’ exposure to the complexities of remote access is minimal.

OSGi HTTP Service is used to enable the local installation of web applications to the device. Local installation capability is very important for the occasionally connected devices to ensure the availability of the application.

More Complex Scenarios

The architecture above describes the simplest form of Rich MobileNet Applications, where the application UI and the services are both installed to the device locally and all communication takes place within the device between these entities. However, RMAs are not limited to this simple architecture only:
  • Services can be external to the device. They can be publicly available web services on the Internet but they can also be services running on another mobile device. RMAs can simply mesh up local and remote services to create some unique user experience.
  • Applications don’t necessarily have to be installed to the device locally. An AJAX-style web application can be just loaded from a public web site on the Internet (or another mobile device) and it can still access services locally on the device (under appropriate access control).
  • The management capabilities of Mobile OSGi enable advanced RMAs to check the availability of required services and initiate their deployment if they are missing.

Conclusion

RMAs are an exciting adaptation of the RIA concept to mobile devices. It enables RIA developers to leverage their knowledge in the mobile space but without compromising the user experience on these limited devices. RMA support will be an integral part of Sprint Titan Platform; it will be in devices early next year. So watch out and prepare, RMAs are around the corner!

Tuesday, March 4, 2008

Developing Titan Applications - Tools

Sprint has released their new Titan platform last week. Titan is a next generation Java platform for Sprint Windows Mobile devices. In addition to supporting existing MIDP Java ME applications, it includes the more capable CDC/Foundation Java Virtual Machine and OSGi framework. You can read more about Titan in Mobile OSGi blog. Titan is currently available for Windows Mobile 6 devices as an installable add on. In the future, devices will ship with pre-installed Titan, and Sprint plans to extend Titan support to other phone categories and platforms as well. This is a very important milestone for mobile OSGi and it opens up very exciting new opportunities for mobile Java. I plan to write a number of articles about how to develop applications for this new platform. However, before starting development work, it worth to have a look at the tools available. There is a step-by-step introduction - in the form of videos - on the Titan page at Sprint ADP. I don't want to repeat the information available there, rather complement it with some practical notes.

The Development Tools

From the Titan page, after some registration you can download the development tools for creating applications for Titan. The tools are based on the Eclipse IDE 3.3 Europa release. First you need to set up the environment. Follow the instructions on video for how to install and configure the development tools. The configuration step is very important in order to make sure that the IDE uses the provided CDC 1.1 Java runtime instead of your installed JDK version and the provided eRCP version as the development target instead of RCP provided as part of the Eclipse IDE.

First Project

Now you're ready to create your first project. The project template creates a simple eRCP application with some basic UI elements. We're ready to try it! Unfortunately, there's no built in device emulator in the toolset. The tool supports on-device execution and debugging (see video) only. So what can you do, if you don't have access to a WM6 device, or you find it more convenient to start first with an emulator on PC? Fortunately, Titan Runtime can be installed to Windows Mobile 6 Emulator.

The Emulator

First download and install the emulator to your PC. The emulator is available in a number of different localized versions, pick the one you like. However. make sure that you download one of the Professional images, Titan doesn't work with the Standard ones. Now you need to install Titan Runtime to the Emulator. The easiest way to get TitanDeviceRuntime-v1.0.CAB to the emulator is via a shared folder. After starting the emulator, you can select a shared folder in File > Configure... menu. The content of the shared folder can be accessed from the Emulator using the File Explorer in the "\Storage Card" folder. Just click on the CAB file to begin the installation. Similarly, you need to install the Titan Device Tools, which enable "on-device" debugging of applications or application startup from the IDE.

Network Setup

The desktop and device-side tool components use sockets for communication, so you need to setup a network access.
  1. First you need to download and install Virtual PC 2007 because the Emulator uses the virtual network adaper support in VPC.
  2. Now you can enable the "NE2000 Network Adapter" in the Network tab of the Configuration window of the Emulator.
  3. After enabling it, you should bind the adapter to one of the network interfaces installed to your PC. For this purpose, I used the Microsoft Loopback Adapter.
  4. You have to assign a static IP address to the emulator, because you have to be able to configure that IP address in the tools in your IDE. Open Settings in the Start Menu of the Emulator, select the Connections tab and then Network Cards. Select the "NE2000 Compatible Ethernet Driver" and then Use specific IP address. I used 192.168.42.1 as the address of the loopback adapter and assigned 192.168.42.2 to the Emulator. You need to softreset the Emulator (File > Reset > Soft) to ensure that the changes take effect.
  5. Finally, you need to configure the development plugins in the IDE. Open Run > Run Dialog..., select OSGi on Device from the list on the left and then fill in the form, entering the IP address in the Device IP field.
Now you can try to run the sample application in the Emulator. Click Run! You should see something like this:

Final Notes

After the installation of Titan Device Tools, a black and blue disc-like icon appears on the task bar. This is a simple application that allows you to manage the lifecycle of the OSGi framework on the device. By default the framework is always running, you can use this application to stop or restart it. Notice that the icon is animating while an operation is in progress! WM6 Emulator emulates an ARM CPU and executes ARM native code, which is quite resource demanding, so don't expect too quick operation. In particular, when you start the emulator, it is useful to wait until the framework completely starts, before trying to run an application.