Information Technology Reference
In-Depth Information
9
Chapter
HTML5 Location-Based
Applications
One of the biggest opportunities presented to mobile developers is the wealth of options
opened up by the very nature of Android devices like phones and tablets: They are
mobile! While the location of a user of a traditional desktop application can be
interesting, it's rare for someone to pick up a desktop machine and move about with it
all day. But mobile devices move, and their location (and, by implication, the location of
the device user) can influence everything from games, to searching for products and
information, to nuances and options for things as diverse as language settings and
device behavior.
In this chapter, we'll explore geolocation in HTML5, CSS, and JavaScript for Android
devices. We'll explore a simple location-enabled app, and see how the features and
functions of HTML5 can be leveraged. So, let's get moving!
The Mechanics of Geolocation
In order to make your geolocation ideas a reality, it's important to understand the
capabilities of all the moving parts (sorry, we couldn't resist that joke). In any Android-
targeted geolocation web application, two sets of capabilities are important. First, what
capabilities does a given Android device present to any web-based location-focused
application? Second, what features of HTML5 (and to a lesser extent, CSS3 and
JavaScript) provide location capabilities? Ultimately, the combination of what a device
can say about its location, and what a web application can do with that information, will
set the boundaries for what you can achieve. Let's look at the background for both.
Understanding Device Capabilities
No matter what kind of device you have, it can rely on a surprising range of technologies
to provide location-based data. Even for devices that lack dedicated hardware, options
145
 
Search WWH ::




Custom Search