Today, if you are planning on building a mobile app there are many questions and key decisions that need to be made upfront. This post will attempt to shed some light on the strengths and weaknesses of HTML5 and Native approaches. For the last couple of years HTML5 has been the “buzz word” that is being thrown around as the “silver bullet” solution from desktop to mobile app. There have been mixed reactions with companies like Facebook and LinkedIn who started with HTML5 and later decided to build apps using the native SDK while others embraced HTML5.
There are HTML5 mobile frameworks such as Sencha Touch, Titanium SDK, PhoneGap (Cordova) and few others that promise “build once deploy everywhere”.
Let us begin by looking at strengths and weaknesses of each approach:
Building an app using the Native SDK gives you direct access to most features of the devices out of the box.
Both Android and iOS have well defined and documented design patterns you need to be familiar with to develop on these platforms. It is important to understand and learn about the design patterns provided by the SDK. This will help you build a robust and maintainable application. Mobile SDK changes frequently and keeping your app up to date is vital for making it work across all devices with different versions of the OS.
The most important aspect of going native is the full hardware support. If your application needs to gain access to Bluetooth, gyroscope and other sensors, Native SDK will help you get the most out of it. At the enterprise level, it may be desirable to utilize add-on accessories such as a bar code scanner and a credit reader where manufacturers provide native library support.
Android and iOS both have a mature IDEs. For Android you can use Eclipse or Android Studio and Xcode for iOS. These robust IDEs enable you to debug and test your application on a device or an emulator with ease.
In summary the strengths of native development are:
1. Robust SDK
2. Streamlined UI design/guidelines
3. Hardware support
4. Debugging application support
As mentioned earlier, as the SDK and hardware on devices gets updated, more time and effort is required to learn and implement solutions. You need to prepare and plan for frequent updates to help manage the time and cost of development. Moreover, you need to maintain the app compliance with the latest SDK changes so that app does not crash when a user updates their mobile device.
Distributing the app to users is different for Android and iOS platforms. For Android, once you register, you can publish the app and within minutes your app goes live in the Google Play Store. In the case of Apple iOS the approval process isn’t as simple or fast. Publishing to Apple App Store requires a few days for the approval process and potentially a few more days to rework the app based on approval process review.
To sum up some drawbacks are:
1. Development Time/Cost to work with different development platforms
2. Evolving changes in the SDK requiring code changes during version upgrades
3. App store restrictions/approval process
4. Expertise in each eco-system such as Objective-C / Android SDK
Building an app using HTML5 can be categorized into two high-level categories. First is mobile web app where the app is hosted on a server and mobile app opens it in web view on the device. Second is a hybrid app consisting of native code and HTML5 code. In either case, there will be a thin application that runs a “Web View” and renders the HTML on the device.
In either case, you do not have to write much, if any, Objective-C/Android SDK code nor know about application life cycle. With a mobile web app you can deploy the new version of the application without having to go through the application review process.
There is an exception to this if it is a hybrid app. For hybrid apps you will need to go through the review process as you make enhancements.
In summary, building in HTML5 would be:
1. Easy to build an App
2. Multiple frameworks such as Sencha Touch, PhoneGap
3. Somewhat of a Vendor independence by writing the app using HTML, JS and CSS, which is supported by both Android and iOS.
4. Abstracted layer of application lifecycle
Even though HTML5 features can provide rich UI, there are limitations to this approach. While the SDK on android devices itself are significantly fragmented, webkits on each OS version (iOS, Android or more) support different implementations of HTML. This results in a non-optimal user experience across devices.
If your app needs to gain access to device specific hardware such as Bluetooth, camera, gyroscope or any other sensors, you would need to either use plugins or write your own native code. This way you may not be getting any advantage of writing it in HTML5.
As the Native SDKs evolve so too are the HTML5 frameworks. If you want to upgrade to the newest framework version you will need to update the plugins that you have used. This may result in doing a major overhaul of your app.
Even though using HTML5 gives you flexibility to use same language for multiple platforms, when it comes to utilizing platform specific features such as Notification bar, Cloud 2 Device messaging, etc. you will need to write platform specific versions of the application code. This means maintaining different versions/branches of same application for each OS.
As pointed out earlier, each Webkit behaves differently on devices. Viewing the same HTML app on your desktop browser and mobile device will result in a different user experience. (Changing the user-agent on your browser is not the same).
Due to limited IDE support debugging your application can be a challenge with HTML5. You could use Firebug or Chrome Developer Tool to a certain extent but it could be challenging if you need to debug within a device at runtime, especially in the case of hybrid apps where code might jump from an HTML5 component to native code component etc.
So in summary, some drawbacks are:
2. No native device hardware support
3. Vendor specific code to perform platform defined features such as Notifications.
5. Debugging the application
The choice is yours: native or HTML5. HTML5 has some benefits as well as some limitations. Writing apps using HTML5 does not give you the freedom of “build once and deploy everywhere” type of solution. However, there are scenarios where HTML5 based applications make perfect sense. If your application needs to show text and form submissions while being online, writing in HTML5 will be good enough. However, you will hit a wall when you need to utilize features specific to OS/hardware.
Native development on the other hand gives you the optimal user experience and full hardware support, but requires you to have different development strategies for each OS.
Starting native is not difficult, you need to know Java for Android. If you are a Java developer you will feel right at home. For iOS you need to know Objective-C. If you are a java developer or have knowledge about OOP, you can pick up objective-c quickly. Both Android and iOS SDKs have very good documentation. The mobile community is growing fast and there are many online resources at your disposal.
I hope this post was informational. Please do not hesitate to comment on this post and share your thoughts.