public class LocationSensor extends AndroidNonvisibleComponent implements Component, OnStopListener, OnResumeListener, Deleteable
Modifier and Type | Field and Description |
---|---|
static int |
UNKNOWN_VALUE
Constant returned by
Longitude() , Latitude() , and
Altitude() if no value could be obtained for them. |
form
ACCELEROMETER_SENSITIVITY_MODERATE, ACCELEROMETER_SENSITIVITY_STRONG, ACCELEROMETER_SENSITIVITY_WEAK, ALIGNMENT_CENTER, ALIGNMENT_NORMAL, ALIGNMENT_OPPOSITE, ASSET_DIRECTORY, BUTTON_SHAPE_DEFAULT, BUTTON_SHAPE_OVAL, BUTTON_SHAPE_RECT, BUTTON_SHAPE_ROUNDED, COLOR_BLACK, COLOR_BLUE, COLOR_CYAN, COLOR_DEFAULT, COLOR_DKGRAY, COLOR_GRAY, COLOR_GREEN, COLOR_LTGRAY, COLOR_MAGENTA, COLOR_NONE, COLOR_ORANGE, COLOR_PINK, COLOR_RED, COLOR_WHITE, COLOR_YELLOW, DEFAULT_VALUE_COLOR_BLACK, DEFAULT_VALUE_COLOR_BLUE, DEFAULT_VALUE_COLOR_CYAN, DEFAULT_VALUE_COLOR_DEFAULT, DEFAULT_VALUE_COLOR_DKGRAY, DEFAULT_VALUE_COLOR_GRAY, DEFAULT_VALUE_COLOR_GREEN, DEFAULT_VALUE_COLOR_LTGRAY, DEFAULT_VALUE_COLOR_MAGENTA, DEFAULT_VALUE_COLOR_NONE, DEFAULT_VALUE_COLOR_ORANGE, DEFAULT_VALUE_COLOR_PINK, DEFAULT_VALUE_COLOR_RED, DEFAULT_VALUE_COLOR_WHITE, DEFAULT_VALUE_COLOR_YELLOW, DIRECTION_EAST, DIRECTION_MAX, DIRECTION_MIN, DIRECTION_NONE, DIRECTION_NORTH, DIRECTION_NORTHEAST, DIRECTION_NORTHWEST, DIRECTION_SOUTH, DIRECTION_SOUTHEAST, DIRECTION_SOUTHWEST, DIRECTION_WEST, FONT_DEFAULT_SIZE, LAYOUT_ORIENTATION_HORIZONTAL, LAYOUT_ORIENTATION_VERTICAL, LENGTH_FILL_PARENT, LENGTH_PREFERRED, LENGTH_UNKNOWN, SLIDER_MAX_VALUE, SLIDER_MIN_VALUE, SLIDER_THUMB_VALUE, TOAST_LENGTH_LONG, TOAST_LENGTH_SHORT, TYPEFACE_DEFAULT, TYPEFACE_MONOSPACE, TYPEFACE_SANSSERIF, TYPEFACE_SERIF
Constructor and Description |
---|
LocationSensor(ComponentContainer container)
Creates a new LocationSensor component.
|
Modifier and Type | Method and Description |
---|---|
double |
Accuracy()
The most recent measure of accuracy, in meters.
|
double |
Altitude()
The most recently available altitude value, in meters.
|
java.util.List<java.lang.String> |
AvailableProviders() |
java.lang.String |
CurrentAddress()
Provides a textual representation of the current address or
"No address available".
|
int |
DistanceInterval() |
void |
DistanceInterval(int interval) |
boolean |
Enabled()
Indicates whether the user has specified that the sensor should
listen for location changes and raise the corresponding events.
|
void |
Enabled(boolean enabled)
Indicates whether the sensor should listen for location chagnes
and raise the corresponding events.
|
boolean |
HasAccuracy()
Indicates whether information about location accuracy is available.
|
boolean |
HasAltitude()
Indicates whether altitude information is available.
|
boolean |
HasLongitudeLatitude()
Indicates whether longitude and latitude information is available.
|
double |
Latitude()
The most recently available latitude value.
|
double |
LatitudeFromAddress(java.lang.String locationName)
Derives Latitude from Address
|
void |
LocationChanged(double latitude,
double longitude,
double altitude)
Indicates that a new location has been detected.
|
double |
Longitude()
The most recent available longitude value.
|
double |
LongitudeFromAddress(java.lang.String locationName)
Derives Longitude from Address
|
void |
onDelete() |
void |
onResume() |
void |
onStop() |
boolean |
ProviderLocked() |
void |
ProviderLocked(boolean lock)
Indicates whether the sensor should allow the developer to
manually change the provider (GPS, GSM, Wifi, etc.)
from which location updates are received.
|
java.lang.String |
ProviderName()
Indicates the source of the location information.
|
void |
ProviderName(java.lang.String providerName)
Change the location provider.
|
void |
RefreshProvider()
Refresh provider attempts to choose and start the best provider unless
someone has set and locked the provider.
|
void |
StatusChanged(java.lang.String provider,
java.lang.String status)
Indicates that the status of the location provider service has changed, such as when a
provider is lost or a new provider starts being used.
|
int |
TimeInterval() |
void |
TimeInterval(int interval) |
getDispatchDelegate
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getDispatchDelegate
public static final int UNKNOWN_VALUE
Longitude()
, Latitude()
, and
Altitude()
if no value could be obtained for them. The client
can find this out directly by calling HasLongitudeLatitude()
or
HasAltitude()
.public LocationSensor(ComponentContainer container)
container
- ignored (because this is a non-visible component)public void LocationChanged(double latitude, double longitude, double altitude)
public void StatusChanged(java.lang.String provider, java.lang.String status)
public java.lang.String ProviderName()
public void ProviderName(java.lang.String providerName)
public boolean ProviderLocked()
public void ProviderLocked(boolean lock)
public void TimeInterval(int interval)
public int TimeInterval()
public void DistanceInterval(int interval)
public int DistanceInterval()
public boolean HasLongitudeLatitude()
public boolean HasAltitude()
public boolean HasAccuracy()
public double Longitude()
public double Latitude()
public double Altitude()
public double Accuracy()
public boolean Enabled()
public void Enabled(boolean enabled)
public java.lang.String CurrentAddress()
public double LatitudeFromAddress(java.lang.String locationName)
locationName
- human-readable addresspublic double LongitudeFromAddress(java.lang.String locationName)
locationName
- human-readable addresspublic java.util.List<java.lang.String> AvailableProviders()
public void RefreshProvider()
public void onResume()
onResume
in interface OnResumeListener
public void onStop()
onStop
in interface OnStopListener
public void onDelete()
onDelete
in interface Deleteable