Java Reference
In-Depth Information
CHAPTER 17
Finding Your Way
F or many developers, the potential of location-based service (LBS) applications is the
most exciting aspect of Java ME development today. The potential for new applications
that use user position in conjunction with web-available data (for geocoded business
locations, locating fellow users, real-time traffic, weather, and other incident informa-
tion) is simply staggering. Whole new markets are emerging, such as cost-effective,
real-time, location-aware navigation; social networking that involves friends' locations;
and dispatch and emergency service applications that tap a device's location transpar-
ently. JSR 179 defines the Location API, which provides a simple optional API for
determining a device's location and sharing location preferences with other applications.
In this chapter, I begin with some brief remarks about LBS for readers who haven't
previously encountered the technologies behind it. Next, I introduce the Location API,
describe the package and classes that JSR 179 defines for enabling LBS on Java ME
devices, and show you how to use the Sun Java Wireless Toolkit to simulate location data
when developing and debugging your applications. I close the chapter by showing you an
extension to the WeatherWidget application that permits users to specify their current
location rather than enter a location when obtaining weather data.
Understanding Location-Based Services
For many years in many countries including the United States, emergency-management
officials have been able to determine the location of telephone callers. (In the United
States, this is a key part of the 911 system; dialing 911 on any phone connects you to
an emergency dispatcher who has information about the location of the phone from
which you're calling.) In the mid-1990s, the governments of many countries moved
to require carriers to provide the same information for wireless telephone users, giving
emergency-response personnel the same capabilities they have when responding to
emergency calls from wireline phones. This drove the creation of a number of mobile
handset location technologies, including Assisted Global Positioning System (A-GPS)
and various cell-tower triangulation systems. Originally intended for use primarily for
emergency purposes, network operators were keen to find a means to charge for this
service, because providing location-based information on the network incurred high
499
 
Search WWH ::




Custom Search