Corona 101: Building Cross-Platform Apps for Diverse Markets
Apps are all the rage these days, and many developers are making lots of money selling them. Perhaps you would like to join the fun and cash in on your app ideas, but you’re uncertain of where to start. Should you develop for Android or iOS (iPhone, iPad, and iTouch)? What about the Nook and Kindle Fire?
To develop for Android (including Nook and Fire), you’d need to learn Android architecture, the Java language, various Java APIs (both Java and Android-oriented), and Android-specific tools. To develop for iOS, you’d need to learn iOS architecture, Objective-C, various iOS APIs, and iOS-specific tools.
Suddenly, your eyes glaze over at the thought of all this learning. Isn’t there a way to minimize the learning curve by developing apps with one single language, one single set of APIs, and one set of development tools that work for both Android and iOS? Fortunately, the answer is yes. You can minimize the steep learning curve of multiple platforms by using Corona.
This series of articles introduces you to Corona. Today, we’ll receive a brief overview of this technology, and then download the Corona trial version. Then, we’ll install this software on your Mac OS X or Windows XP (or later) platform. In the next article, we’ll explore Corona, examining and modifying a sample app project.
What Is Corona?
Corona is a software development kit for writing multimedia-rich and high-performance apps (be they game apps, non-game apps, or interactive ebook apps), testing them, and building/packaging them for deployment to an Android or iOS platform. This SDK is available for Mac OS X and Windows XP (or later).
Note: You can build an app for both Android and iOS via the Mac OS X version of the SDK. However, you can only build for Android via the Windows XP (or later) version because of an Apple licensing issue.
You write an app in a scripting language called Lua (a Portuguese word for Moon), and take advantage of powerful APIs that let you quickly write the app. Many APIs are available, including those that help you monetize your apps through in-app purchases, banner ads, and offer-based virtual currency.
Note: Corona includes a physics engine that lets you easily deal with physical phenomena (e.g., gravity), detect collisions, and more in your games or other apps.
You can preview the app via Corona’s simulator (discussed later) for Android, iPhone, iPad, or iTouch. Changes can be quickly viewed in the simulator, increasing productivity. When you’re ready, you can build the app’s distribution file for Android or iOS (Mac OS X SDK version only) at the press of a button.
Note: Corona doesn’t automatically publish your app to an app store (e.g., iTunes or Google Android Market). You must perform this task manually.
Corona is a product of Ansca Mobile, a mobile software company based in Palo Alto California. Co-founders Carlos Icaza and Walter Luh started Ansca Mobile after leaving Adobe in 2007. At Adobe, they worked on Flash Lite, a lightweight Adobe Flash Player version for mobile devices.
Download the Corona Trial Version
Ansca Mobile offers trial and subscription versions of Corona. The trial version is free and of unlimited length; the subscription version requires a yearly fee of $349 US (there are discounts when registering for 2 or 3 years).
I recommend that you download the trial version to find out if Corona is the right tool for your app development needs before investing money in this software. As well as being free, the trial version offers the following benefits (as does the subscription version):
- Test and preview apps on the desktop in the Corona Simulator
- Build apps for Android or iPhone/iPad/iPod Touch (Mac OS X SDK only) devices
- Obtain unlimited access to all of Corona’s simple and powerful APIs
Note: For a complete comparison between the trial and subscription versions, point your browser to Ansca Mobile’s Buy Corona page.
Let’s download the trial version. Begin by pointing your browser to Ansca Mobile’s main page, as shown in Figure 1.
Near the bottom of the window, you’ll observe a Try Corona link. Clicking this link takes you to the registration window shown in Figure 2.
You must register to download the Corona SDK. Enter your email address and a password, and indicate that you accept the SDK’s terms and conditions before clicking Continue. Figure 3 shows the resulting page.
Ansca Mobile responds by sending a validation email message to the previously entered email address. Follow this message’s instructions, which consist of clicking a validation link, to complete registration so that you can gain full access to the website. (You do not need to respond to this email to download the SDK.)
Finally, select your operating system (Mac OS X or Microsoft Windows) by clicking the appropriate radio button, and click the Download button. At time of writing, you can download the CoronaSDK-2011.704.msi
installer for Windows or the CoronaSDK-2011.704a.dmg
installer for Mac OS X.
Note: The Mac OS X version of the SDK requires the Mac OS X 10.6 (or later), Intel Mac development platform. Apps created with the Mac-version SDK support iOS 3.1 or greater (including iOS 5), and support Android OS 2.2 or greater (on the ARMv7 architecture). The Windows version of the SDK requires a Windows XP (or later) development platform running at a speed of 1 GHz or higher. Apps created with the Windows-version SDK support Android 2.2 or greater (on the ARMv7 architecture). For either SDK, Corona-built apps will not install on Android ARMv6 devices.
I downloaded CoronaSDK-2011.704.msi
to my 64-bit Windows 7 platform. After downloading this installer file, I verified its integrity to ensure that it hadn’t been tampered with or corrupted in some other fashion, which is unlikely. (Your antivirus software probably won’t detect every possibility.)
Look at Figure 3 and you’ll see the following line associated with the CoronaSDK-2011.704.msi
installer file:
md5: cc5909f812604b03bf3897b05510a7b6
This line identifies the file’s MD5 signature, which is expressed as a sequence of 32 hexadecimal digits. (MD5 stands for Message Digest version 5. This algorithm is commonly used to check data integrity. Visit Wikipedia’s MD5 entry to learn more about MD5.)
To verify that the installer file is not corrupt, you must obtain a program that calculates the file’s MD5 signature, compares it with the signature above, and outputs an indication of whether or not the file is okay. One such program is the MD5 command-line message digest utility located here.
This utility consists of an md5
executable that takes as arguments the expected signature and the name of the file whose signature is to be computed and compared against the expected signature. md5
returns zero when the signatures match (the file is okay) or a nonzero value otherwise. Consider the following example:
md5 -ccc5909f812604b03bf3897b05510a7b6 CoronaSDK-2011.704.msi
You would run md5
in the context of a Windows batch file or the equivalent Unix shell script. For example, Listing 1 shows the contents of a Windows-based check.bat
file that runs md5
.
@echo off
md5 -ccc5909f812604b03bf3897b05510a7b6 CoronaSDK-2011.704.msi
rem Read md5's return code and transfer execution to label err if it's not 0.
if errorlevel 1 goto err
echo okay
goto end
:err
echo error
:end
Listing 1 (above): A batch file for testing the CoronaSDK-2011.704.msi
installer file’s integrity
Assuming a Windows platform, and that the current directory contains check.bat
and the installer file, execute check
by itself at the command line. If all is well, you’ll observe okay as the output. Otherwise, you’ll observe error.
Install the Corona Trial Version
To install Corona, double-click the installer file. Doing so on a Windows platform results in the introductory dialog box shown in Figure 4.
Click the Next button and you’ll arrive at the license agreement dialog box shown in Figure 5.
Read the license agreement and, if you agree, accept it by clicking the I Agree radio button. Then, click the Next button, which is enabled after selecting this radio button. Figure 6 shows the resulting dialog box.
You can keep the default installation folder or choose another location. Click the Disk Cost button to determine if there’s sufficient space on the target disk. Click Next and you’ll arrive at Figure 7.
Click Next to begin installation. Corona presents the installation progress dialog box shown in Figure 8.
When installation finishes, the installer presents a completion dialog box with a Close button that you click to terminate the installer. At this point, Corona is installed on your platform.
I installed Corona to C:Program Files (x86)AnscaCorona SDK
on my Windows 7 platform. The CoronaSDK home directory contains several files and subdirectories, including a Sample Code directory that organizes the sample code included with the SDK into various subdirectories. For example, Sample Code’s GettingStarted
subdirectory organizes various projects that help you get started with Corona.
That should be enough to get you up and running with Corona. Next time, we’ll explore Corona further and build our first app within it.