October 23, 2014
Hot Topics:
RSS RSS feed Download our iPhone app

A Crash Course in Android Web Applications

  • September 6, 2011
  • By Lauren Darcey & Shane Conder
  • Send Email »
  • More Articles »

Most of the time, we focus on about developing native Android applications in Java. However, there is another, important way to reach Android users that we don't often talk about: Web applications. There are two ways that users can consume Web applications on Android devices:

  1. Using the built-in Browser application (or an alternative browser the user installs)
  2. From within native Android applications that use embedded WebView controls

A WebView control is a configurable control that you can include within your user interface that allows you to load and display Web content much as a browser would.

Why a Mobile Web Application on Android?

Web applications, in general, have a number of benefits over native applications. First, they tend to be cheaper to develop, because there are a lot more Web developers in the world than mobile developers. Second, they can be updated on the fly, making them more flexible to roll out updated content to users. Third, Android Web applications are written using well-established Web standards, which are generally supported across many different mobile platforms, so you can write once, and run just about everywhere. Finally, you don't need to worry too much about supporting different devices, since they all use basically the same browser.

There's a lot of existing knowledge and methods for supporting different browsers, but the Web browser, as a platform, is basically the same. When looking at just Android devices, the Web browser really is the same.

Why Develop Native Android Apps?

Native applications have some distinct advantages over pure Web applications. Native applications have higher performance, the ability to function without a network connection, are tailored to the specific device and have access to the underlying device features and functionality not accessible to a Web application. Accessing device features not exposed to Web applications requires the use of the Android Java SDK. On Android, native applications have access to many easy mechanisms for supporting alternate resources.

Hybrid native applications that use WebView controls help bridge this gap, often providing more benefits than drawbacks. For example, you get the benefit of having local resources, native access to the SDK (see below), and exposure on the various app stores available to promote your content. You can even use the native interface to speed up particular portions of your application that may not be very fast in pure JavaScript. The main drawback of this approach is that, unless you have separate designs for each platform, your application may not feel like other purely native applications, in terms of consistency of native controls (menus, fragments, widgets, and so on).

Which Android Devices Support Web Applications?

All Android devices support Web applications, be they consumed through the Browser application or embedded in native applications using the WebView control. The Android Browser is based upon WebKit technology, upon which popular browsers like Google Chrome and Safari are based. The WebView tool uses the WebKit rendering engine as well.

Some minor updates to the Browser and WebView control have been included as Android devices have evolved. Android 2.2 introduced detection and customization of content based upon device screen characteristics and motion event handling. Android 3.0 introduced private browsing sessions.

Android devices can render Web content with JavaScript, CSS, HTML5, etc. Exactly what features are supported is not strongly documented. You are highly encouraged to use feature detection in your JavaScript.

Devices running Android 2.2 and higher can also display Flash, now on version 10.3, provided they have installed the appropriate Adobe player installed.

Speaking of Flash, Adobe also supports Android as a target of Adobe AIR applications. Like a native Web app, Adobe AIR applications install as their own app, but are Flash apps using the Adobe AIR platform. In order for Adobe AIR applications to run, the user's device must have the Adobe AIR app installed.

Fine-Tune Web Apps and Websites for Mobile Devices

Most mobile platforms include browsers these days. Websites, on the other hand, are really feature-rich. They tend to be media-heavy, with complex style sheets, tons of graphics, videos, sounds, flash and ads, not to mention text. These websites are easily consumed from a laptop or desktop computer, where users tend to have reasonable screen sizes, dedicated high speed data connections, and full-sized input devices (you know, like real keyboards and mice). Mouse hover actions are common, as are multi-column content (like in a newspaper) and complex site navigation suited to big screens.

Mobile browsing is different. Devices tend to have much less processing power and slower networks. Screens are small and narrow. Navigation is generally achieved by using finger tapping and swiping motions--the touch paradigm. When developing Web applications, these differences between traditional browsing and mobile browsing need to be recognized and addressed.

Generally, this means that you will design a special version of your website or Web application specifically for mobile users. Your Web server can use incoming browser information to direct mobile users to a special mobile site using server-side redirects. You'll also want to focus on using mobile Web best practices.


Tags: Android, mobile web development

Originally published on http://www.developer.com.

Page 1 of 2



Comment and Contribute

 


(Maximum characters: 1200). You have characters left.

 

 


Sitemap | Contact Us

Rocket Fuel