Open Source

Developing for Mobile Internet Devices: Part 1

By Paul Ferrill, October 09, 2009

Tools, choices, and development environment configuration

Developer Tools

Most seasoned developers have a preferred set of tools they feel most comfortable using. For many in the open source world, this toolset equates to Eclipse and some number of add-ins. Although Eclipse was built on Java technology and counts Java developers as its largest user base, it does support other languages quite well. Nokia uses Eclipse as the foundation of its developer tools to deliver a high-end experience complete with emulation and target device deployment for the Nokia N810 family of devices.

Anjuta is another IDE with a substantial following. Anjuta is written in the C language and uses C for its API and plug-in architecture. It does provide decent support for both C++ and Python, as well. Support for other languages, including C#, is in the works. Of particular interest to UI designers is the integrated Glade tool, with tight support for editing and creating Glade files.

Intel has a number of open source tools available to developers serious about squeezing the most out of their applications. New power-management profiling tools make it possible for developers to determine exactly how much power individual pieces of their code consume. The Application Energy Toolkit evaluates applications to determine how "power aware" they are. Versions for Windows, Linux, and Mac OS X version 10.5 Leopard are available. Specifically for mobile developers, the Intel Mobile Platform SDK offers a number of different tools to facilitate building "mobile aware" applications.

Emulation

One of the best ways to test your software without actually loading it onto the target device is through emulation. A number of emulation tools work only in the Linux environment. Red Flag Software uses Xnest in conjunction with chroot in its SDK for Midinux, which makes it possible to run in virtually the same environment you would be running on the target device. For our purposes, there's a how-to on the Red Flag site for configuring its SDK to work with Xnest.

The Moblin project uses a similar approach with its Moblin Image Creator (MIC) tool. This GUI application helps you create a target Moblin image for a specific platform, then test it by using Kernel-based Virtual Machine (KVM). MIC can also build VMware VMDK images for use with VMware's player application, which gives you the option of running completely inside a virtual environment without making any modifications to your host machine.

Getting Started

The best place to start with any project is the beginning. Developing a set of requirements that meet your goals helps determine the overall direction of the project. Even if the project is fairly simple, it always helps to write down what your application will do. For this effort, I focus on an application that will take advantage of a number of the MID features, including the GPS and Wi-Fi connectivity.

It's a good idea to go through the process of creating the typical "hello world" application after you have your development environment configured to your liking. This might seem like a trivial exercise, but it confirms your ability to build your code then deploy it to your target platform. It might also help you think through how best to automate the process to save time in the future.

Be sure to enable Secure Shell (SSH) on the target platform to make it possible to enter commands remotely. For the JAX10 notebook, you must type a command in a terminal window on the device to start the SSH daemon. Launching a terminal window requires you to press the Fn and P keys simultaneously (Function P), which brings up a prompt similar to this:

When that's done, you'll be able to use an SSH client tool to connect remotely to the device. You need the IP address to connect: You can find that information with the IFCONFIG command.

Avoid Common Problems

Don't get bogged down in the details too early in the process. Trying to write code to accomplish a task you don't understand well is not a good idea. Reading the documentation and studying example source code for any library or packaged code you choose to use could actually save you time in the long run. Reading through forums or old IRC logs can help answer questions and provide some insight as to how others have approached similar problems in the past.

Don't be afraid to build small proof of concept applications to figure out how something works -- say, how to connect to the GPS or how to properly size a button based on the display dimensions of the device. Look for other code that accomplishes the same thing. Don't be too proud to learn from someone else's work. The Python community has a large body of code to do just about anything you can think of. You can find a wealth of searchable code examples on the ActiveState Python Cookbook site.

Do use some type of source control system for tracking revisions and keeping your source code backed up. It's a good idea to either use a hosted service or run the main source code repository on separate machine from your development computer. Then, you'll always have a way to recover should something happen to that machine. Concurrent Versions System (CVS) has been around forever, while Subversion (SVN) and Git are more recent possibilities.

Summary

Building software applications for the MID platform requires a new mindset and a good set of tools to do the job right. Keep these things in mind when starting out:

Choose a good IDE that you're comfortable with.

Use a popular Linux distribution like Ubuntu for the operating system of your development computer.

Don't skimp on your development hardware, and do get a machine with a recent processor and ample memory.

Use good software development practices, like gathering requirements and using a source code control tool.

Dr. Dobb's encourages readers to engage in spirited, healthy debate, including taking us to task.
However, Dr. Dobb's moderates all comments posted to our site, and reserves the right to modify or remove any content that it determines to be derogatory, offensive, inflammatory, vulgar, irrelevant/off-topic, racist or obvious marketing or spam. Dr. Dobb's further reserves the right to disable the profile of any commenter participating in said activities.

This month's Dr. Dobb's Journal

This month,
Dr. Dobb's Journal is devoted to mobile programming. We introduce you to Apple's new Swift programming language, discuss the perils of being the third-most-popular mobile platform, revisit SQLite on Android
, and much more!