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.

16 comments:

Maxim said...

Gabor, I'm getting the following error on both the emulator and my WM6 device: "The Sprint Titan stack evaluation license has expired!" Am I forgetting a step or how can I get this to run?

Thanks in advance,
Maxim

Pici said...

Yes, the problem is that the Beta release license is temporary and it expired on March 31. Unfortunately this bit of information was forgotten from the Titan page.
Sprint already has the license update, a small CAB file that can be installed to extend the license period and they should publish it soon. Hopefully this time they will mention the expiration date as well.

-p

Maverick said...

Hi,
The document was quite informative for me to set up the environment. Thanks. When I try to run a sample application from eclipse I get this error "Exception trying to establish connection via IAgent."
Any pointers regarding this ? Thanks in advance.
-ss

SPS said...

Hi,
As mentioned in the post, I have configured the emulator and windows loopback adapter. I am able to ping the emulator and windows loopbak adapter. But when I try to run sample application at specified IP (emulator's ip), I get "Instrument Agent exception: -5007" error. Am I missing something ? Thanks in advance.
Regards,
Sarvesh

Pici said...

@Sam and @Sarvesh: It's a it hard to remotely diagnose the issue, but the issue is very often that the WM Emulator is very slow. It takes a long time to start up all the components of Titan. So it is possible that IAgent didn't start properly yet.

The error code -5007 means "Device connector was disconnected from the device and the connection cannot be reestablished." so in this case it is also possible that some process crashed in the Emulator. So try to restart it and give it some time for properly start all components.

-p

PS: Sorry for the late answer, I already posted an answer once, and I just realized that it disappeared somehow.

lukewpatterson said...

Thanks for the great blog entry.

Those interested in stepping through your examples should be aware of these issues:

"Eclipse plugin does not work" at http://developer.sprint.com/show_thread.do?forumId=368&searchBy2=MSG_PARENT_ID&searchValue2=-1&searchBy3=MSGFORUM_FORUMID&searchValue3=368&ps=10&pn=1&threadid=26201&sortDirection=0&sortCol=MSG_AUDIT_CREATE_DT

and

"Titan Runtime license has expired" at http://developer.sprint.com/show_thread.do?forumId=368&searchBy2=MSG_PARENT_ID&searchValue2=-1&searchBy3=MSGFORUM_FORUMID&searchValue3=368&ps=10&pn=1&threadid=26220&sortDirection=0&sortCol=MSG_AUDIT_CREATE_DT


Best Regards,
Luke

Rajalaxmi.C said...

hello... i am also getting the error Instrument Agent exception: -5006"...... i have restarted the emulator and the IDE... but still there is something wrong.... please tell me how i can debug the error.... i dont know whether the pbm is in the emulator or the IDE.... can i give any random IP address in the settings of the emulator?... do i have to give the default gateway adress? can it be anything?... please help... i ll be very grateful...
Thank you
ur blog is indeed excellent......!!!!!!!!!!!!!
thanks once again
Raji

Anonymous said...

you have a nice site. thanks for sharing this site. there are various kinds of ebooks are available here

http://feboook.blogspot.com

sukumar said...

wonderful article i appreciate this post keep it more mobile application. more importance is application in the mobile.Mobile Application Development

Mobile Application Development said...

Even i am also getting the same problem. So many time i restarted the emulator but no use. Why i coming in this way?How to slove this solution? Can u give me the explanation about this?
Thank you nice information. awesome post.

Mobile Application Development

Android app developers said...

How we can develop Blackberry application I learn from your post.This is some what different application.This is one of the new advance post.

Unknown said...

The adobe suite (specifically dreamweaver, flash builder, air, flash pro, etc. - although I do not have the version that can compile what I design as a Android Mobile Apps), eclipse (either on it's own or with rhomobile or JBoss).

android app development dubai said...

Nice Job!!!
I hope you will post new article as soon as possible.

Abel Michel said...

This is a very important landmark for cellular and it reveals up very interesting new possibilities for Java based mobile.

Happyfutolearn said...

Portable and wireless, Kindle is the most popular online book reading device. Amazon is a famous American corporation that produces it. In 2007, the first Kindle was released. Since its release, the Amazon company's Kindle has made its way into the hearts of multiple users, which has made it the world's most renowned and celebrated e-reading platform. Read more: https://crawlinfo.com/services/how-to-reach-kindle-support-number/

Happyfutolearn said...

Venmo is a mobile digital payment service and social app that is owned by PayPal. The Venmo app makes it simple to communicate with friends and transfer and receive money. What started as a text-messaging network has evolved into a digital wallet software with over 60 million users that including the Venmo Visa credit card and Venmo Mastercard debit card.
Read more at:activate venmo card