Posted on

Mobile Cross Platform Development : Corona

Anscamobile CoronaWe recently wrote an article on our experience using Apache Cordova to build cross-platform mobile devices.   It works for quick prototypes or simple mobile apps but the are compromises.   Here we touch on our experiences using Corona by Ansca Mobile.

Testing The Apps

One of the things we dislike about Corona is the fact that testing on an ACTUAL DEVICE is a cumbersome process.  The short version, build the app, find your OS level tools, manually push the app into the phone.  Doesn’t sound hard until you start playing with command-line tools to move stuff around.  Yeah, we are tech geeks, but who wants to see this sort of thing constantly during the build/test cycle?

Corona Android App Install

Another fun “feature” of this method is what happens when you are UPDATING an app for testing.  Since you are using the command line the process of updating needs to be done in a 2-step process, UNINSTALL first, the install.  Forget to uninstall and you get an error.   What is a simple 1-step GUI operation in Eclipse with Cordova becomes a 2-step command-line operation in Corona, and that becomes 3+ steps if your command line interface is not already open.

Cordova Wins This Battle…

The Eclipse interface used with Apache Cordova is FAR EASIER.  Select “run”.  If a single mobile device is attached it loads and runs.  If more than one is attached it asks “one which device”.  If none are attached it runs in the simulator.

Corona wants to ALWAYS run in the simulator. The simulator is good, but not great.   We often see graphic anomalies.  You also have no way to test the camera, or other real-world things like degree of tilt, etc.  Testing on a real-world mobile device should be 10x easier with Corona.

Documentation Out of Date

There are a number of areas where the documentation for Corona is out-of-date.   This is a huge problem for people not familiar with the Corona builds.   Sadly you often have to search the forums to get accurate functionality from other Corona users.    For example, the Android GPS permissions are documented in the Corona API and Build settings with obsolete settings:

settings =
{
android =
{
versionCode = “3”
},

androidPermissions =
{
“android.permission.ACCESS_FINE_LOCATION”,
“android.permission.INTERNET”
},

orientation =
{
default = “landscapeRight”
},
}

The proper settings are noted in the forum:

In Corona, you can add these <uses-feature> tags via the “build.settings” file as follows…

settings =

{
android =
{
usesPermissions =
{
“android.permission.ACCESS_COARSE_LOCATION”,
},
usesFeatures =
{
{name=”android.hardware.location”, required=false},
{name=”android.hardware.location.network”, required=false},
{name=”android.hardware.location.gps”, required=false},
}
}
}

With a note by a Corona guru …

We added “usesPermissions” and “usesFeatures” as of build 704. We haven’t documented them yet. So, I apologize for the confusion.

Sadly this note is over 2 months old and the documentation is still wrong.

Android Features Missing

One of the problems with Corona, as noted in our prior article about Cordova, is that there is no support for some device specific features.  Two of these , camera and orientation change, are key to many mobile apps and quickly eliminates Corona from consideration.

From the Corona website Android build docs:

The following features available for iPhone devices are not yet implemented, or fully implemented, for Android device builds:

Camera
Activity indicator
Orientation changes
OpenAL audio: limited support

More shortcomings, in our first attempt we find out we can’t use the map API, which sucks as we are building a map application.

MapView is currently iOS-only, and therefore will not run in the Corona Simulator. Build for iOS devices or for the XCode Simulator to use this feature. For an example of many of these APIs, see the new “MapView” sample project distributed with the SDK.

From the Corona Map API page

Notes about the Android issues, which affect Kindle Fire and Nook, are prevalent:

On Android, the default orientation setting has no effect. The orientation is initialized to the actual orientation of the device (unless only one orientation is specified). Also, the only supported orientations are landscapeRight and portrait. On a device, you can flip to either landscapeRight or landscapeLeft, but the OS only reports one flavor of landscape, and Corona’s orientation event chooses landscapeRight.

From the Corona Configure Projects page.

Vendor Lock-In

Perhaps one of the most troublesome issues with Corona is the vendor lock-in.   When using this system you only retain and have control of the Lua code.   The problem is that the pre-processors and compilers run on THEIR servers. That means Corona has the actual source code for the Java and Objective-C version of your Lua code.

If Anscamobile goes out of business, you are out of luck.   If you let your subscription expire you are out of luck.  If they raise subscription prices by 5,000% you are in trouble.   If their servers crash, your internet connection drops, or any other number of issues come up you cannot update your apps.

If you go this route you are absolutely tied into & dependent on Corona for your mobile apps survival.   Is that part of your business plan?  Is Corona listed as a business partner?  If not, they are a partner now whether you like it or not.

Summary

It is very clear early on in the evaluation process that Anscamobile’s Corona environment heavily favors and is geared for the Apple developer.   There are numerous shortcomings and missing features for Android devices.   That is odd since they tout the Android, Kindle, and Nook devices which are all distinctly non-IOS platforms.

It also seems as though there are a lot more “cant’ do that on the other platform” shortcomings with Corona than Cordova.   Yes, Cordova has issues as well, but there seems to be a much more concerted effort to get every feature in Cordova to work on all platforms.

Thus, Corona looks like a solid IOS development platform that *may* get some apps over to Android.  However, if you are going to build in what is almost an IOS only environment, why not just build with Objective-C?    Essentially Corona feels like a Lua-language alternative to Objective-C for people that find Objetive-C too hard to code in.    The cross-platform support still has a ways to go.