Web Development for Mobile Devices is the latest rage. But what if you want an "off-line" web application? No problem!
The Mobile Web Application
For years the mobile development experience has been a game of “my widgets are cooler than your widgets.”
Or “My development environment is faster than yours”.
The truth is that quality applications often take a lot of time and energy to write well. Sure, the first 90 percent may go quickly enough using — particularly if you are using the latest tool or framework — whichever it is — it doesn’t reall matter. It’s the “second 90 percent” that takes time and talent.
You still need to know how things work under the hood — one day you will find yourself in a corner and have to code your way out of it.
So if you are going to invest in some development skills, where do you spend that capital? How about web technologies?
Web as a better Widget
On the premise that every platform takes time and sweat to learn and become proficient in, why not invest in a set of skills that are nearly universally applicable?
Web technologies present a very compelling environment for a developer to invest their time and talent in. If you learn web skills, you can build some pretty exciting and useful applications today — and for multiple platforms including: desktop, enterprise, and yes, even mobile.
A “web” application makes a lot of sense when you are connecting to a web server — either an “Internet” application or an Enterprise “intranet” application. In these applications the value is generally found in the backend database and/or corporate business data sources. But what if our application is largely “client” oriented — the kind of apps you might buy in an app store? Does it make sense then? Sure thing.
Taking it Native
Web applications can provide remarkably sophisticated user interfaces thanks to powerful rendering engines as CSS capabilities continue to expand — and the canvas tag is quite capable in and of itself. Javascript is a challenging yet profoundly powerful programming environment, enabling a wide array of applications — much more than just “form validation scripts”. And Ajax can bring in pieces of data from servers when and if they are required.
OK, but my cool mobile device has GPS, a Camera and an MP3 player. And an SQL database. Can those features be leveraged also? Yes.
I want my application in the app-store, can I package it up and sell it? Yes.
So how does this work? By taking the web native.
In previous articles, we have discussed the merits of projects such as PhoneGap and Appcelerator Titanium. These environments permit developers to write applications in HTML, CSS and Javascript — for all of the reasons listed above and more. And they give access to the “native” APIs like GPS, Contacts, Camera, etc. Once the application is ready, it can even be submitted to the app store of choice for distribution and to bring the developer fame and fortune.
In the balance of this column we are going to look at an ultra-simple native web application. It is not meant to compete with the more robust native web platforms like PhoneGap and Appcelerator — it is designed to take a peak under the hood of that kind of solution and show how it works. This example is for Android, though there are similar and analogous techniques for other platforms including iPhone, BlackBerry, webOS, etc. Let’s get started.
Granular WebKit
At the core, a native web application relies on an “embedded browser object”. In the Android world, this is known as a WebView view (or control), found in the android.webkit package. In fact, this package contains a number of classes exposing a variety of browser-related functionality. Using these classes remind me of the old “MasterMind” board game — a moment to learn, a lifetime to master. OK, so its not that hard, but there are a bunch of moving pieces to become familiar with. To describe some of these, we will look at a sample application which performs a couple of basic tasks:
- Write to the the Android Log, with separate functions for Info and Error level entries
- Exit the application
These functions are clearly not very exciting, but they are demonstrative of the bigger picture — writing an application in HTML, CSS and Javascript which interacts with the environment beyond the browser on the device.
By the way, if your only interest is to show an external webpage from your application, you would likely be better served to simply launch the on-device browser. Using the WebView control is meant for applications where you want to exercise more control over the functionality for your “on device” or native application.
As exhibit A, demonstrating that our application is indeed a native application, here is a screen shot of the application icon on the Android launcher screen.

The code for the application, named GoingNative, is available on the linuxdlsazine Mobile code hosting site.
The Application
The application presents a very simple user interface including a title, a piece of text in a heading tag, a single input form element, three buttons and a static image. The html file and the image are both packaged in the apk file — there is no need to go to the Internet to run this “native web” application. The image below shows the project in an Eclipse workspace.

And here is a screen shot of the application in action.

Note that this image has the application running in the emulator. The screen in the background is showing a portion of the DDMS perspective in Eclipse. We can see that the application com.msi.linuxmag.goingnative has a process id of 2723 and in the lower portion of the shot we see a couple of entries from our application. We’ll see how those came to be in the log in a moment.
Let’s see how this application is constructed. We’ll start with the HTML.
Comments on "Under the Hood of Native Web Apps for Android"
Usually posts some very interesting stuff like this. If you?re new to this site.
Usually posts some very fascinating stuff like this. If you are new to this site.
Just beneath, are several completely not associated internet sites to ours, nevertheless, they are surely worth going over.
I like to spend my free time by scaning various internet recourses. Today I came across your site and I found it is as one of the best free resources available! Well done! Keep on this quality!
Want to be a part of an incredible workforce?
Usually posts some extremely exciting stuff like this. If you are new to this site.
Wonderful story, reckoned we could combine some unrelated data, nevertheless really worth taking a search, whoa did one particular master about Mid East has got a lot more problerms as well.
Below you will find the link to some websites that we consider you should visit.
Usually posts some pretty interesting stuff like this. If you are new to this site.
DVD Movies: Older blockbusters, children’s movies and classic movies are usually good sellers.
The war raged on and their bookstore was destroyed when Manila was declared an ‘open city’ to America’s
bombing attacks in order to drive away Japan’s Imperial Army.
This type of professional occupation is highly in demand in (1) New York
City, NY, (2) San Francisco, CA (3) Los Angeles,
CA, (4) Columbus, OH, and Chicago, IL.
Also visit my blog post; giuseppe zanotti mens
Wonderful story, reckoned we could combine a handful of unrelated information, nevertheless really really worth taking a appear, whoa did a single find out about Mid East has got extra problerms too.
That will be the end of this post. Right here you will obtain some internet sites that we consider you will appreciate, just click the hyperlinks.
That will be the finish of this article. Here you?ll obtain some websites that we believe you?ll value, just click the hyperlinks.
That would be the end of this report. Here you will locate some internet sites that we believe you?ll enjoy, just click the links.
Here is a good Blog You might Obtain Fascinating that we encourage you to visit.
Wonderful story, reckoned we could combine a handful of unrelated information, nonetheless definitely really worth taking a appear, whoa did a single discover about Mid East has got far more problerms at the same time.
Check beneath, are some completely unrelated internet websites to ours, on the other hand, they are most trustworthy sources that we use.
Please go to the sites we adhere to, including this one, as it represents our picks from the web.
Here is a good Weblog You might Find Fascinating that we encourage you to visit.
Wonderful story, reckoned we could combine several unrelated information, nonetheless seriously really worth taking a appear, whoa did 1 discover about Mid East has got extra problerms too.
Just beneath, are a lot of absolutely not related web-sites to ours, having said that, they may be certainly really worth going over.
That would be the finish of this article. Right here you?ll obtain some web pages that we feel you?ll appreciate, just click the hyperlinks.
Please pay a visit to the web-sites we adhere to, such as this a single, because it represents our picks from the web.
Usually posts some quite intriguing stuff like this. If you?re new to this site.
Always a big fan of linking to bloggers that I adore but don?t get a lot of link adore from.
Here are some hyperlinks to web sites that we link to mainly because we assume they’re really worth visiting.
Check beneath, are some totally unrelated web-sites to ours, nevertheless, they are most trustworthy sources that we use.
Although internet websites we backlink to beneath are considerably not associated to ours, we really feel they may be in fact worth a go by way of, so have a look.
Always a significant fan of linking to bloggers that I adore but really don’t get a whole lot of link appreciate from.
We like to honor many other world wide web sites around the net, even if they aren?t linked to us, by linking to them. Below are some webpages really worth checking out.
Below you will locate the link to some sites that we consider you’ll want to visit.