I decided to go back to an old stand-by with mobile development, in particular Android. But now what has been frazzling my brain is whether to use the regular Java path, or an HTML5 path. Since I don't plan on making any 3D games for quite some time, OpenGL ES and native C/C++ code is of no importance. But basically here is how I break both down:
Java for Android:
Pros:
* The most supported, obviously.
* Access to all native and Google APIs, for things such as location services, Google Maps, etc.
* Access to all hardware functionality, such as GPS, accelerometer, NFS, and more.
* Possibly better performance.
Cons:
* Sometimes dealing with poor design decisions (more on that below).
* Performance out of Java may not be much be much better than HTML5, since best performance is with OpenGL in C.
* Poor porting path to other platforms. Basically stuck as Java for Android.
HTML5 for Android:
Pros:
* Most apps and games do not need more than HTML5 provides.
* App Mobi tools claim to bridge the gap to native functionality.
* Much better path to being cross-platform. iOS, WP7, Blackberry versions and others will in some cases be a button click away.
* Future platforms are aiming square at HTML5, such as Windows 8 and Firefox Mobile OS.
* Apps can be posted to the web with the same code.
* Simpler development.
Cons:
* Less support and community. Whether using App Mobi or Phone Gap, that is basically your entire community.
* Access to native and Google APIs may be limited.
* Access to some hardware beyond the touch screen will be limited.
* Potential for slightly lower performance.
When I mentioned occasional poor design choices, check out this Dalvik Java code:
Code: Select all
@Override
protected Dialog onCreateDialog(int id) {
switch (id) {
case 0:
return new AlertDialog.Builder(this)
.setIcon(R.drawable.ic_launcher)
.setTitle(“This is a dialog with some simple text...”)
.setPositiveButton(“OK”,
new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int whichButton)
{
Toast.makeText(getBaseContext(),
“OK clicked!”, Toast.LENGTH_SHORT).show();
}
}
)
.setNegativeButton(“Cancel”,
new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int whichButton)
{
Toast.makeText(getBaseContext(),
“Cancel clicked!”, Toast.LENGTH_SHORT).show();
}
}
)
.setMultiChoiceItems(items, itemsChecked,
new DialogInterface.OnMultiChoiceClickListener() {
public void onClick(DialogInterface dialog,
int which, boolean isChecked) {
Toast.makeText(getBaseContext(),
items[which] + (isChecked ? “ checked!”:” unchecked!”),
Toast.LENGTH_SHORT).show();
}
}
).create();
}
return null;
}
}It is displaying a dialog box with 3 strings and a radio group. Yes, I am serious. Basically the same dialog you can create in .NET in 2 lines of code takes this whole ugly garbled mess in Android because the UI is completely made of XML. Wow, I wish JSON had come first so we didn't have to deal with XML. In HTML5 the same results could be done so much more cleanly in about 1/3 the lines or less.
Anyway, does anyone have any input on the Android app path? I am really leaning more towards HTML5 at the moment. I already own Impact and an App Mobi XDK account, so either way I go is no cost to me. It just seems like things are easier the HTML5 way, plus the added bonus of extremely cross-platform compatibility with 1 set of code.