Codename One: A Cross-Device Platform for Mobile App Development

The proud boast of Codename One developers is, Write once, run anywhere native mobile apps. And it works exactly that way. You can use your existing Java skills to target iOS, Android and Windows devices with just one code base. Already, 120 million apps have been built on this platform!

In the current era of technology based products and applications, almost every business service is compatible with mobile devices. Mobile applications are everywhere, be it e-commerce, e-bidding, e-learning, e-reservations, discussion forums, e-banking or social media. Users are increasingly accessing the Internet on their mobile phones rather than on a PC or laptop. Hence there is immense scope for developing new mobile apps for multiple uses and devices.
There are a number of frameworks and platforms available to develop mobile phone apps. And the R&D teams of leading software development companies continue to explore this domain in order to come up with more dynamic products and services for the global market.
Table 1 gives a list of prominent mobile app development platforms and frameworks, which integrate the tools for user interface design and SDK for device-specific features with cross-platform compatibility modules.

Table 1

Codename One: Free and open source software with SaaS (Software as a Service)

Codename One is among the prominent and unique device-independent platforms used for the development of cross-platform applications. It can be used to develop Java based applications that are deployed on any mobile device, irrespective of the base platform.
With Codename One, there is no need to write the mobile apps for different devices separately. The same code can be deployed with the same functionality and user interface in all the devices. The platform takes up very little memory, so applications developed with it can be executed on just 2MB of RAM, which is relatively low. This is a very significant feature because it means that apps developed on Codename One can run on virtually any smartphone.
As on June 30, 2015, there were 120 million apps installed that were built on Codename One, and 32,970 developers were using Codename One as per statistics given on the platforms portal.
In short, Codename One is a cross-device platform that allows developers to create code in Java, which can work with any device including iPhone/iPad, Android, BlackBerry, Windows Phone 7 and J2ME devices.

Figure 1: Codename One

Figure 2: Installing new software in Eclipse

Components and modules in Codename One
Codename One is a framework or, simply, a suite of tools, which is specifically developed for mobile application development, mostly related to Java architecture. The key goal behind the project is to accept the multiple, complex as well as fragmented tasks of mobile phone programming, and then to integrate and process them under a set or cluster of tools, services and APIs. This is a powerful approach to mobile app development that does not compromise on control.

Figure 3: Specifying the URL of Codename One in Eclipse

Figure 4: Codename One fetched by the server in Eclipse

Figure 5: Creating a new project of type, Codename One

Codename One has a strong association with a number of different modules and services to support the development of powerful mobile phone applications:

APIs

Plugins

IDE integration

Simulator

Designer

Build servers

Cloud servers

There are a number of advantages of using Codename One, some of which are listed below:

Extremely fast and effective simulator with a good GUI designer

Debugging as well as profiling tools available for standard Java application development

Developer-friendly with drag-and-drop implementation for rapid application development

The resources are scaled automatically as per different DPIs

There is no specific need for permissions, manifests and grants, as the software automatically detects and implements the required permissions and grants

The resources can be dynamically downloaded

The component hierarchy or views is comparatively simple in Codename One

Figure 6: Selecting the theme and templates

Figure 7: Project Explorer in Codename One

Figure 8: Codename One GUI designer

Figure 9: Sample out-put in the simulator

Downloading, installing and integrating Codename One with the Eclipse IDE
Codename One can be installed on any Java based IDE including Eclipse, IntelliJ IDEA, NetBeans, etc.
The screenshots illustrate the installation of Codename One in Eclipse as a plugin (see Figures 2 to 9).
The URL to be specified in Eclipse is https://codenameone.googlecode.com/svn/trunk/CodenameOne/repo/eclipse/site.xml

The author is the managing director of Magma Research and Consultancy Pvt Ltd, Ambala Cantonment, Haryana. He has 16 years experience in teaching, in industry and in research. He is a projects contributor for the Web-based source code repository SourceForge.net. He is associated with various central, state and deemed universities in India as a research guide and consultant. He is also an author and consultant reviewer/member of advisory panels for various journals, magazines and periodicals. The author can be reached at [email protected]