Java Reference
In-Depth Information
Understanding the Location API
The
javax.microedition.location
package defines nine classes, two interfaces, and two
exceptions. Other than the exceptions, which inherit from
Exception
, the class hierarchy
is almost completely flat, representing the simplicity of the API and the domain it
abstracts. The package provides the following classes:
•
LocationProvider
: Represents a hardware or software module within the device that
can determine the device's location. It provides a static factory method that returns
specific
LocationProvider
instances configured to respond to specific location
requests.
•
Criteria
: Represents specific criteria that apply to a location request, such as the
desired accuracy and cost to the user.
•
Location
: Represents a collection of basic information about a location, including a
timestamp, coordinates, accuracy, speed, course, and information about the
method used to determine the location, as well as an optional textual address.
•
Coordinates
: Represents the latitude, longitude, and altitude of a location, and pro-
vides methods to interconvert between floating-point and human-readable textual
representations of coordinates.
•
QualifiedCoordinates
: Represents the latitude, longitude, and altitude triple
associated with a measurement of the coordinates' accuracy. It is a subclass of
Coordinates
.
•
AddressInfo
: Represents textual information about a location such as the street
address. The
AddressInfo
class encapsulates a collection of fields accessed through
manifest constants.
•
Orientation
: Represents the physical orientation in space of the terminal, including
azimuth (the horizontal pointing direction), pitch (the vertical elevation angle),
and roll (the orientation around the device's own longitudinal axis).
•
LandmarkStore
: Represents a store of individual user landmarks. There is always a
default landmark store, and implementations may provide additional named land-
mark stores for application use.
•
Landmark
: Represents a known location with a user-provided name, consisting of
the name, a
QualifiedCoordinates
object, and an
AddressInfo
object.
The API defines two interfaces:
LocationListener
and
ProximityListener
. The
LocationListener
gives your application a means to regularly receive position reports
from the API implementation through its
locationUpdated
method, and it permits the