Java Reference
In-Depth Information
Table 17-2.
Location Methods and Location Bit Field Values
Method
Bit in Bit Mask Asserted
Note
MTA_ASSISTED
MTY_NETWORKBASED
and
MTY_TERMINALBASED
indicate assistance
source
Assisted by other means
MTA_UNASSISTED
No assistance used
MTE_ANGLEOFARRIVAL
Angle of arrival
Angle of incident radiation on antenna used
MTE_CELLID
Cell ID
Cell tower IDs used in determination
MTE_SATELLITE
Satellite
Satellite system (e.g., GPS) used
MTE_SHORTRANGE
Short range
Bluetooth or other wireless network
system used
MTE_TIMEDIFFERENCE
Time difference
Time difference between received
terrestrial signals used
MTE_TIMEOFARRIVAL
Time of arrival
Time of arrival of received terrestrial
signals used
MTY_NETWORKBASED
Network-based method
Network used in assisting request
MTY_TERMINALBASED
Terminal-based method
Position determination used terminal-
based method
The Location API provides the
Coordinates
and the
QualifiedCoordinates
classes to
represent a specific place in space. A
Coordinates
instance is absolute, specifying lati-
tude, longitude, and elevation, with no error;
QualifiedCoordinates
extends the notion
of
Coordinates
by adding information regarding the horizontal and vertical uncertainty
in meters. The
Coordinates
class provides methods for obtaining coordinate values
(
getAltitude
,
getLatitude
, and
getLongitude
), as well as a generic conversion method
(
convert
) for converting between floating-point and string representations of a coordi-
nate. You can also obtain the azimuth and distance between coordinates by invoking
one
Coordinates
'
azimuthTo
and
distance
methods, passing each a second coordinate.
Because the
LocationProvider
always provides real measurements, it will always return
a
QualifiedCoordinate
; you can determine the uncertainty of a specific location meas-
urement using the result's
getHorizontalAccuracy
and
getVerticalAccuracy
methods.
Your application may require more than one location measurement; you can either
invoke a
LocationProvider
's
getLocation
method repeatedly or register an object that
implements
LocationListener
to receive location events. Registering a
LocationListener
with a
LocationProvider
via the
setLocationListener
method takes four arguments:
•
listener
: The
LocationListener
implementation that receives the location events
•
interval
: Specifies how often to determine the location and send location events to
the listener