Java Reference
In-Depth Information
The Criteria object you create specifies any specific requirements you have regard-
ing the locations your application will request. The Location API implementation uses
these to configure and select a specific LocationProvider instance. Table 17-1 shows the
specific criteria you can specify within a Criteria object. If the implementation cannot
explicitly meet your criteria, it will make its own best-effort selection, provided that the
resulting LocationProvider instance meets your specific cost criteria. The Criteria class
provides the constants NO_REQUIREMENT , POWER_USAGE_LOW , POWER_USAGE_MEDIUM , and
POWER_USAGE_HIGH to describe the case where no criteria apply and to describe specific
power-consumption criteria. Listing 17-1 sets a single criterion for the LocationProvider
instance: that the location determination fall within ten meters of the probable location
of the device.
Table 17-1. Criteria for Location Provider Configuration
Criteria
Units
Default Value
Setter
Accessor
NO_REQUIREMENT setHorizontalAccuracy
getHorizontalAccuracy
Horizontal
Meters
accuracy
NO_REQUIREMENT setVerticalAccuracy
getVerticalAccuracy
Vertical
Meters
accuracy
Milliseconds NO_REQUIREMENT setPreferredResponseTime
getPreferredResponseTime
Preferred
response
time
int
NO_REQUIREMENT setPreferredPowerConsumption getPreferredPowerConsumption
Power
consumption
boolean
true (permitted setCostAllowed
isAllowedToCost
Cost
allowed
to incur cost
to the user)
boolean
false
setSpeedAndCourseRequired isSpeedAndCourseRequired
Speed
and course
required
boolean
false
setAltitudeRequired
getAltitudeRequired
Altitude
required
boolean
false
setAddressInfoRequired
isAddressInfoRequired
Address
required
The LocationProvider class is a factory of LocationProvider instances, as well as a
factory of Location objects and a notifier of location and proximity information. You
obtain a specific LocationProvider instance through the class's LocationProvider.
getInstance method, passing a Criteria instance that describes the restrictions that
should apply to the positioning work the LocationProvider will perform. Once you have
 
Search WWH ::




Custom Search