The Android software platform offers a wide range of facilities that can be configured to meet many different tasks. Developing software to operate within the Android environment means writing in Java. Few embedded developers currently use Java for many historic reasons: concern about memory size, program performance, power consumption and more. Most of these concerns have proven to be unfounded, but the new style of embedded application development requires new thinking and new tools.
In this overview of Android software development we’ll explore how to develop a new application, power control, and some Android built-in functions like compressed binary Java code that reduces memory usage. Then we’ll consider COTS products from the Intel Embedded Alliance members that can run Android – regardless of their form factor.
The seventies, eighties, and nineties saw ‘C’ become the dominant language for programming a wide variety of systems. ‘C’ started as a systems-focused language for developing the Unix operating system and associated utilities. The University standard for developing programming skills was based on ‘C’ in North America until recent times. Now, Universities have adopted Java as the language of choice to teach new programmers fundamental skills. Embedded systems programming is beginning to adopt Java as well, but Java-friendly operating environments are just beginning to add capabilities for hard real-time programming. Nevertheless, Java is on the cusp of acceptance as a required language for embedded systems programmers.
Java is the product of decades of development based on threaded-interpretive machines. A Java platform includes an implementation of the Java Virtual Machine (JVM), a byte coded virtual computer. The fact that the intended environment for Java programs is interpretive, gives rise to both the flexibility of the system, and concern over performance. The use of the JVM extends the development platforms that may be used to create Java applications.
There are a number of ways to learn Java including free online tutorials such as:
Realtime Java is addressed by other online tutorials:
As with most embedded programming, developing code for an embedded system is best run on the target hardware. Developing a Java-based application targeted for Android involves the same decisions as any other embedded project: will the software be developed initially using an emulator or on physical hardware with the same or similar capabilities as the final intended hardware platform, what tools are required to create an application delivery package, and can Android Java apps be developed using my existing tools?
Android embraces both emulated hardware and real physical hardware, providing flexibility for developers. The choice is a matter of the state-of-readiness of the final hardware platform. Software development often needs to begin creating the application before final hardware is available. Emerson Network Power (1) provides a COTS hardware solution that is specifically promoted as a platform for Android-based systems. The Emerson NITX-300 Series Development Board I is based on the Intel® Atom™ processor and includes Gigabit Ethernet, SATA, USB, serial ports, touchscreen, LCD, PCI Express x1 and PCI Express Mini Card slots. The NITX-300 is used by Thunder Software Technology Co.,Ltd (Thundersoft) (2) to deliver a medical tablet computer software embedded applications package. The Android software supplied has been adapted to serve the Tablet market. Called the BigDroid, Thundersoft delivers new display management that handles large format displays and touch screen technology.
Advantech (3) HIT-W121 is another system that explicitly supports Android. It was featured as a “teardown” article in EETimes that attributed Intel’s Atom processor performance as one of the reasons why Advantech chose the processor – combined with Intel’s engineering support. The HIT-W121 includes a 11.6” touchscreen and Intel’s ICH8 I/O hub. The I/O Hub supports the PCI Express and local bus, ACPI power management, and enhanced DMA. It is also available with an expended number of USB ports, high-definition audio, and a Gigabit Ethernet controller.
The growing popularity of Android for non-telecommunications applications is spawning a new group of service providers. Adeneo Embedded (4) is one of these companies. Adeneo is a full service contract engineering firm that can assist is developing Android-based systems starting with evaluation, moving to systems architecture, on to applications development and finally to fielding the final system. Like Adeneo, ArcherMind Technology (Nanjing) Co., Ltd (5), iwave systems technologies pvt ltd, and Mobica Limited (6) also provide similar engineering services for Android systems using Intel processors.
Developing an Android-based Java application requires creating an “.apk” file that has been signed with a key denoting the .apk is either for debug or release. Without automation, the development task requires that engineers perform a number of individual steps that are purely mechanical. Tool chain suppliers including Green Hills Software (7), Intel, and Wind River Systems (8) all base their development tool platform on the Eclipse environment. When using tool chains from any of these suppliers, developers may choose to use a utility supplied with the Android environment to automate the creation of an .apk file from the Java source and specified libraries and non-compiled objects like images.
Programming in Java is different from ‘C’ because it is completely object oriented and encompasses syntactic and semantic structures that serve to eliminate certain classes of programming errors.
Structurally, Java looks similar, but different from ‘C’:
public class HelloWorld
public static void main(String args)
The ubiquitous “Hello World” program is defined as a class in Java; the filename of the class must be the same as the class. By comparison, a ‘C’ program source file can be named as the programmer wishes. The Java compiler creates a new file with the extension class. For the example above, a new file named HelloWorld.class is compiled from HelloWorld.java. Java programs are assembled in packages, but you don’t have to write all the necessary code yourself. Java includes more than 300 packages with thousands of individual functions. And Android has a rich library of functions already pretested and certified.
Android’s management of virtual devices and the associated API aids in the transition from emulated hardware to final hardware during the development process. Since most common peripherals are already defined as classes moving from an emulated environment to a delivery platform is simplified – providing that you use standard defined APIs. Some hardware, like Thundersoft’s BigDroid tablet displays, require extensions to the standard Android display class. But, it’s possible to maintain compatibility between standard Android environments and environments using tablet displays by defining the extended classes to that the same API is still used.
Java was developed by programmers developing for workstation environments, and the native Java tools reflect that viewpoint. Eclipse-based toolchains provide a convenient mechanism to replace workstation-focused scripting languages while providing all of the control that is intrinsic in the Android SDK.
Like many other systems, power control is best addressed at the software architectural layer because that’s where the biggest paybacks can happen. But there’s still low hanging fruit for Android applications – mostly related to wireless communications and display brightness settings. Many of these choices are selected by the Android user, but you can influence their choices. Apps in the Android Marketplace, like the Power Widget, give users the ability to control how their Android-based handheld uses power. But there are other choices that you can make. If the Android device is designed using an AMOLED display, choosing to use a black background as the default in your app will save up to 85% of the power as compared to a white background. You can also close the application automatically if a logical place exists to do so and further extend battery life. Lastly, design your software so that it makes minimal use of GPS and radio functions – permitting them to be turned off when not in actual use. Users may still select less optimal power configurations, but there’s plenty of room to influence their choices.
Some intrinsic Android design decisions serve to minimize memory usage - both for program storage and during runtime execution. Recall that we talked briefly about the multitude of steps required to compile and prepare a program for execution on an Android platform. Android is based on a byte-code Java virtual machine. This Java machine interprets the byte-codes that make up each specific program. By choosing to compile to a byte-code format, programs are automatically smaller than the typical native machine code that results if the Java program is compiled to the underlying, physical, target computer. My experience with byte-coded machines is that byte-coded programs can be one third the size of natively compiled programs. Android takes this a step further. A special tool is used by the Android SDK to translate “normal” Java byte-codes to another virtual machine called Dalvik. Dalvik includes a 16 word register file as part of its architecture which results in object code that is even smaller and faster than the original Java byte-codes.
Java is gaining more realtime facilities as embedded development demands more reliability and faster development times.
- Emerson Network Power is a Premier member of the Intel Embedded Alliance
- Thunder Software Technology Co. is a General member of the Intel Embedded Alliance
- Advantech is a Premier member of the Intel Embedded Alliance
- Adeneo Embedded is an Affiliate member of the Intel Embedded Alliance
- ArcherMind Technology (Nanjing) Co., Ltd is a General member of the Intel Embedded Alliance
- iWave Systems Technologies is a General member of the Intel Embedded Alliance
- Mobica Limited is a General member of the Intel Embedded Alliance
- Green Hills Software is an Affliate member of the Intel Embedded Alliance
- Wind River Systems is an Associate member of the Intel Embedded Alliance
Roving Reporter (Intel Contractor)
Intel® Embedded Alliance