Fields Summary |
---|
public static final int | NO_REQUIREMENTA constant indicating that the application does not choose to
place requirement on a particular feature. |
public static final int | POWER_LOWA constant indicating a low power requirement. |
public static final int | POWER_MEDIUMA constant indicating a medium power requirement. |
public static final int | POWER_HIGHA constant indicating a high power requirement. |
public static final int | ACCURACY_FINEA constant indicating a finer location accuracy requirement |
public static final int | ACCURACY_COARSEA constant indicating an approximate accuracy requirement |
public static final int | ACCURACY_LOWA constant indicating a low location accuracy requirement
- may be used for horizontal, altitude, speed or bearing accuracy.
For horizontal and vertical position this corresponds roughly to
an accuracy of greater than 500 meters. |
public static final int | ACCURACY_MEDIUMA constant indicating a medium accuracy requirement
- currently used only for horizontal accuracy.
For horizontal position this corresponds roughly to to an accuracy
of between 100 and 500 meters. |
public static final int | ACCURACY_HIGHa constant indicating a high accuracy requirement
- may be used for horizontal, altitude, speed or bearing accuracy.
For horizontal and vertical position this corresponds roughly to
an accuracy of less than 100 meters. |
private int | mHorizontalAccuracy |
private int | mVerticalAccuracy |
private int | mSpeedAccuracy |
private int | mBearingAccuracy |
private int | mPowerRequirement |
private boolean | mAltitudeRequired |
private boolean | mBearingRequired |
private boolean | mSpeedRequired |
private boolean | mCostAllowed |
public static final Parcelable.Creator | CREATOR |
Methods Summary |
---|
private static java.lang.String | accuracyToString(int accuracy)
switch (accuracy) {
case NO_REQUIREMENT:
return "---";
case ACCURACY_HIGH:
return "HIGH";
case ACCURACY_MEDIUM:
return "MEDIUM";
case ACCURACY_LOW:
return "LOW";
default:
return "???";
}
|
public int | describeContents()
return 0;
|
public int | getAccuracy()Returns a constant indicating desired accuracy of location
Accuracy may be {@link #ACCURACY_FINE} if desired location
is fine, else it can be {@link #ACCURACY_COARSE}.
if (mHorizontalAccuracy >= ACCURACY_HIGH) {
return ACCURACY_FINE;
} else {
return ACCURACY_COARSE;
}
|
public int | getBearingAccuracy()Returns a constant indicating the desired bearing accuracy.
Accuracy may be {@link #ACCURACY_LOW}, {@link #ACCURACY_HIGH},
or {@link #NO_REQUIREMENT}.
return mBearingAccuracy;
|
public int | getHorizontalAccuracy()Returns a constant indicating the desired horizontal accuracy (latitude and longitude).
Accuracy may be {@link #ACCURACY_LOW}, {@link #ACCURACY_MEDIUM},
{@link #ACCURACY_HIGH} or {@link #NO_REQUIREMENT}.
return mHorizontalAccuracy;
|
public int | getPowerRequirement()Returns a constant indicating the desired power requirement. The
returned
return mPowerRequirement;
|
public int | getSpeedAccuracy()Returns a constant indicating the desired speed accuracy
Accuracy may be {@link #ACCURACY_LOW}, {@link #ACCURACY_HIGH},
or {@link #NO_REQUIREMENT}.
return mSpeedAccuracy;
|
public int | getVerticalAccuracy()Returns a constant indicating the desired vertical accuracy (altitude).
Accuracy may be {@link #ACCURACY_LOW}, {@link #ACCURACY_HIGH},
or {@link #NO_REQUIREMENT}.
return mVerticalAccuracy;
|
public boolean | isAltitudeRequired()Returns whether the provider must provide altitude information.
Not all fixes are guaranteed to contain such information.
return mAltitudeRequired;
|
public boolean | isBearingRequired()Returns whether the provider must provide bearing information.
Not all fixes are guaranteed to contain such information.
return mBearingRequired;
|
public boolean | isCostAllowed()Returns whether the provider is allowed to incur monetary cost.
return mCostAllowed;
|
public boolean | isSpeedRequired()Returns whether the provider must provide speed information.
Not all fixes are guaranteed to contain such information.
return mSpeedRequired;
|
private static java.lang.String | powerToString(int power)
switch (power) {
case NO_REQUIREMENT:
return "NO_REQ";
case POWER_LOW:
return "LOW";
case POWER_MEDIUM:
return "MEDIUM";
case POWER_HIGH:
return "HIGH";
default:
return "???";
}
|
public void | setAccuracy(int accuracy)Indicates the desired accuracy for latitude and longitude. Accuracy
may be {@link #ACCURACY_FINE} if desired location
is fine, else it can be {@link #ACCURACY_COARSE}.
More accurate location may consume more power and may take longer.
if (accuracy < NO_REQUIREMENT || accuracy > ACCURACY_COARSE) {
throw new IllegalArgumentException("accuracy=" + accuracy);
}
if (accuracy == ACCURACY_FINE) {
mHorizontalAccuracy = ACCURACY_HIGH;
} else {
mHorizontalAccuracy = ACCURACY_LOW;
}
|
public void | setAltitudeRequired(boolean altitudeRequired)Indicates whether the provider must provide altitude information.
Not all fixes are guaranteed to contain such information.
mAltitudeRequired = altitudeRequired;
|
public void | setBearingAccuracy(int accuracy)Indicates the desired bearing accuracy.
Accuracy may be {@link #ACCURACY_LOW}, {@link #ACCURACY_HIGH},
or {@link #NO_REQUIREMENT}.
More accurate location may consume more power and may take longer.
if (accuracy < NO_REQUIREMENT || accuracy > ACCURACY_HIGH) {
throw new IllegalArgumentException("accuracy=" + accuracy);
}
mBearingAccuracy = accuracy;
|
public void | setBearingRequired(boolean bearingRequired)Indicates whether the provider must provide bearing information.
Not all fixes are guaranteed to contain such information.
mBearingRequired = bearingRequired;
|
public void | setCostAllowed(boolean costAllowed)Indicates whether the provider is allowed to incur monetary cost.
mCostAllowed = costAllowed;
|
public void | setHorizontalAccuracy(int accuracy)Indicates the desired horizontal accuracy (latitude and longitude).
Accuracy may be {@link #ACCURACY_LOW}, {@link #ACCURACY_MEDIUM},
{@link #ACCURACY_HIGH} or {@link #NO_REQUIREMENT}.
More accurate location may consume more power and may take longer.
if (accuracy < NO_REQUIREMENT || accuracy > ACCURACY_HIGH) {
throw new IllegalArgumentException("accuracy=" + accuracy);
}
mHorizontalAccuracy = accuracy;
|
public void | setPowerRequirement(int level)Indicates the desired maximum power level. The level parameter
must be one of NO_REQUIREMENT, POWER_LOW, POWER_MEDIUM, or
POWER_HIGH.
if (level < NO_REQUIREMENT || level > POWER_HIGH) {
throw new IllegalArgumentException("level=" + level);
}
mPowerRequirement = level;
|
public void | setSpeedAccuracy(int accuracy)Indicates the desired speed accuracy.
Accuracy may be {@link #ACCURACY_LOW}, {@link #ACCURACY_HIGH},
or {@link #NO_REQUIREMENT}.
More accurate location may consume more power and may take longer.
if (accuracy < NO_REQUIREMENT || accuracy > ACCURACY_HIGH) {
throw new IllegalArgumentException("accuracy=" + accuracy);
}
mSpeedAccuracy = accuracy;
|
public void | setSpeedRequired(boolean speedRequired)Indicates whether the provider must provide speed information.
Not all fixes are guaranteed to contain such information.
mSpeedRequired = speedRequired;
|
public void | setVerticalAccuracy(int accuracy)Indicates the desired vertical accuracy (altitude).
Accuracy may be {@link #ACCURACY_LOW}, {@link #ACCURACY_MEDIUM},
{@link #ACCURACY_HIGH} or {@link #NO_REQUIREMENT}.
More accurate location may consume more power and may take longer.
if (accuracy < NO_REQUIREMENT || accuracy > ACCURACY_HIGH) {
throw new IllegalArgumentException("accuracy=" + accuracy);
}
mVerticalAccuracy = accuracy;
|
public java.lang.String | toString()
StringBuilder s = new StringBuilder();
s.append("Criteria[power=").append(powerToString(mPowerRequirement));
s.append(" acc=").append(accuracyToString(mHorizontalAccuracy));
s.append(']");
return s.toString();
|
public void | writeToParcel(android.os.Parcel parcel, int flags)
parcel.writeInt(mHorizontalAccuracy);
parcel.writeInt(mVerticalAccuracy);
parcel.writeInt(mSpeedAccuracy);
parcel.writeInt(mBearingAccuracy);
parcel.writeInt(mPowerRequirement);
parcel.writeInt(mAltitudeRequired ? 1 : 0);
parcel.writeInt(mBearingRequired ? 1 : 0);
parcel.writeInt(mSpeedRequired ? 1 : 0);
parcel.writeInt(mCostAllowed ? 1 : 0);
|