Location Class
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
A data class representing a geographic location.
[Android.Runtime.Register("android/location/Location", DoNotGenerateAcw=true)]
public class Location : Java.Lang.Object, Android.OS.IParcelable, IDisposable, Java.Interop.IJavaPeerable
[<Android.Runtime.Register("android/location/Location", DoNotGenerateAcw=true)>]
type Location = class
inherit Object
interface IParcelable
interface IJavaObject
interface IDisposable
interface IJavaPeerable
- Inheritance
- Attributes
- Implements
Remarks
A data class representing a geographic location. A location consists of a latitude, longitude, timestamp, accuracy, and other information such as bearing, altitude and velocity.
All locations generated through LocationManager
are guaranteed to have a valid latitude, longitude, timestamp (both Unix epoch time and elapsed realtime since boot), and accuracy. All other parameters are optional.
<p class="note">Note that Android provides the ability for applications to submit "mock" or faked locations through LocationManager
, and that these locations can then be received by applications using LocationManager to obtain location information. These locations can be identified via the #isMock()
API. Applications that wish to determine if a given location represents the best estimate of the real position of the device as opposed to a fake location coming from another application or the user should use this API. Keep in mind that the user may have a good reason for mocking their location, and thus apps should generally reject mock locations only when it is essential to their use case that only real locations are accepted.
Java documentation for android.location.Location
.
Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.
Constructors
Location(IntPtr, JniHandleOwnership) |
A constructor used when creating managed representations of JNI objects; called by the runtime. |
Location(Location) |
Constructs a new location copied from the given location. |
Location(String) |
Constructs a new location with a named provider. |
Properties
Accuracy |
Returns the estimated horizontal accuracy radius in meters of this location at the 68th percentile confidence level. -or- Set the horizontal accuracy in meters of this location. |
Altitude |
The altitude of this location in meters above the WGS84 reference ellipsoid. -or- Set the altitude of this location in meters above the WGS84 reference ellipsoid. |
Bearing |
Returns the bearing at the time of this location in degrees. -or- Set the bearing at the time of this location, in degrees. |
BearingAccuracyDegrees |
Returns the estimated bearing accuracy in degrees of this location at the 68th percentile confidence level. -or- Set the bearing accuracy in degrees of this location. |
Class |
Returns the runtime class of this |
Creator | |
ElapsedRealtimeAgeMillis |
A convenience methods that returns the age of this location in milliseconds with respect to the current elapsed realtime. |
ElapsedRealtimeMillis |
Return the time of this fix in milliseconds of elapsed realtime since system boot. |
ElapsedRealtimeNanos |
Return the time of this fix in nanoseconds of elapsed realtime since system boot. -or- Set the time of this location in nanoseconds of elapsed realtime since system boot. |
ElapsedRealtimeUncertaintyNanos |
Get the uncertainty in nanoseconds of the precision of |
Extras |
Returns an optional bundle of additional information associated with this location. -or- Sets the extra information associated with this fix to the given Bundle. |
Handle |
The handle to the underlying Android instance. (Inherited from Object) |
HasAccuracy |
Returns true if this location has a horizontal accuracy, false otherwise. |
HasAltitude |
Returns true if this location has an altitude, false otherwise. |
HasBearing |
True if this location has a bearing, false otherwise. |
HasBearingAccuracy |
Returns true if this location has a bearing accuracy, false otherwise. |
HasElapsedRealtimeUncertaintyNanos |
True if this location has an elapsed realtime uncertainty, false otherwise. |
HasMslAltitude |
Returns true if this location has a Mean Sea Level altitude, false otherwise. |
HasMslAltitudeAccuracy |
Returns true if this location has a Mean Sea Level altitude accuracy, false otherwise. |
HasSpeed |
True if this location has a speed, false otherwise. |
HasSpeedAccuracy |
Returns true if this location has a speed accuracy, false otherwise. |
HasVerticalAccuracy |
Returns true if this location has a vertical accuracy, false otherwise. |
IsComplete |
Return true if this location is considered complete. |
IsFromMockProvider |
Returns true if this is a mock location. |
JniIdentityHashCode | (Inherited from Object) |
JniPeerMembers | |
Latitude |
Get the latitude in degrees. -or- Set the latitude of this location. |
Longitude |
Get the longitude in degrees. -or- Set the longitude of this location. |
Mock |
Returns true if this location is marked as a mock location. -or- Sets whether this location is marked as a mock location. |
MslAltitudeAccuracyMeters |
Returns the estimated Mean Sea Level altitude accuracy in meters of this location at the 68th percentile confidence level. -or- Sets the Mean Sea Level altitude accuracy of this location in meters. |
MslAltitudeMeters |
Returns the Mean Sea Level altitude of this location in meters. -or- Sets the Mean Sea Level altitude of this location in meters. |
PeerReference | (Inherited from Object) |
Provider |
Returns the name of the provider associated with this location. -or- Sets the name of the provider associated with this location |
Speed |
Returns the speed at the time of this location in meters per second. -or- Set the speed at the time of this location, in meters per second. |
SpeedAccuracyMetersPerSecond |
Returns the estimated speed accuracy in meters per second of this location at the 68th percentile confidence level. -or- Set the speed accuracy of this location in meters per second. |
ThresholdClass |
This API supports the Mono for Android infrastructure and is not intended to be used directly from your code. |
ThresholdType |
This API supports the Mono for Android infrastructure and is not intended to be used directly from your code. |
Time |
Returns the Unix epoch time of this location fix, in milliseconds since the start of the Unix epoch (00:00:00 January 1, 1970 UTC). -or- Sets the Unix epoch time of this location fix, in milliseconds since the start of the Unix epoch (00:00:00 January 1 1970 UTC). |
VerticalAccuracyMeters |
Returns the estimated altitude accuracy in meters of this location at the 68th percentile confidence level. -or- Set the altitude accuracy of this location in meters. |
Methods
BearingTo(Location) |
Returns the approximate initial bearing in degrees east of true north when traveling along the shortest path between this location and the given location. |
Clone() |
Creates and returns a copy of this object. (Inherited from Object) |
Convert(Double, Format) |
Converts a latitude/longitude coordinate to a String representation. |
Convert(String) |
Converts a String in one of the formats described by |
DescribeContents() |
Describe the kinds of special objects contained in this Parcelable's marshalled representation. |
Dispose() | (Inherited from Object) |
Dispose(Boolean) | (Inherited from Object) |
DistanceBetween(Double, Double, Double, Double, Single[]) |
Computes the approximate distance in meters between two locations, and optionally the initial and final bearings of the shortest path between them. |
DistanceTo(Location) |
Returns the approximate distance in meters between this location and the given location. |
Dump(IPrinter, String) |
Dumps location information to the given Printer. |
Equals(Object) |
Indicates whether some other object is "equal to" this one. (Inherited from Object) |
GetElapsedRealtimeAgeMillis(Int64) |
A convenience method that returns the age of this location with respect to the given reference elapsed realtime. |
GetHashCode() |
Returns a hash code value for the object. (Inherited from Object) |
JavaFinalize() |
Called by the garbage collector on an object when garbage collection determines that there are no more references to the object. (Inherited from Object) |
Notify() |
Wakes up a single thread that is waiting on this object's monitor. (Inherited from Object) |
NotifyAll() |
Wakes up all threads that are waiting on this object's monitor. (Inherited from Object) |
RemoveAccuracy() |
Remove the horizontal accuracy from this location. |
RemoveAltitude() |
Removes the altitude from this location. |
RemoveBearing() |
Remove the bearing from this location. |
RemoveBearingAccuracy() |
Remove the bearing accuracy from this location. |
RemoveElapsedRealtimeUncertaintyNanos() |
Removes the elapsed realtime uncertainty from this location. |
RemoveMslAltitude() |
Removes the Mean Sea Level altitude from this location. |
RemoveMslAltitudeAccuracy() |
Removes the Mean Sea Level altitude accuracy from this location. |
RemoveSpeed() |
Remove the speed from this location. |
RemoveSpeedAccuracy() |
Remove the speed accuracy from this location. |
RemoveVerticalAccuracy() |
Remove the vertical accuracy from this location. |
Reset() |
Sets the provider to null, removes all optional fields, and sets the values of all other fields to zero. |
Set(Location) |
Turns this location into a copy of the given location. |
SetHandle(IntPtr, JniHandleOwnership) |
Sets the Handle property. (Inherited from Object) |
ToArray<T>() | (Inherited from Object) |
ToString() |
Returns a string representation of the object. (Inherited from Object) |
UnregisterFromRuntime() | (Inherited from Object) |
Wait() |
Causes the current thread to wait until it is awakened, typically by being <em>notified</em> or <em>interrupted</em>. (Inherited from Object) |
Wait(Int64, Int32) |
Causes the current thread to wait until it is awakened, typically by being <em>notified</em> or <em>interrupted</em>, or until a certain amount of real time has elapsed. (Inherited from Object) |
Wait(Int64) |
Causes the current thread to wait until it is awakened, typically by being <em>notified</em> or <em>interrupted</em>, or until a certain amount of real time has elapsed. (Inherited from Object) |
WriteToParcel(Parcel, ParcelableWriteFlags) |
Flatten this object in to a Parcel. |
Explicit Interface Implementations
IJavaPeerable.Disposed() | (Inherited from Object) |
IJavaPeerable.DisposeUnlessReferenced() | (Inherited from Object) |
IJavaPeerable.Finalized() | (Inherited from Object) |
IJavaPeerable.JniManagedPeerState | (Inherited from Object) |
IJavaPeerable.SetJniIdentityHashCode(Int32) | (Inherited from Object) |
IJavaPeerable.SetJniManagedPeerState(JniManagedPeerStates) | (Inherited from Object) |
IJavaPeerable.SetPeerReference(JniObjectReference) | (Inherited from Object) |
Extension Methods
JavaCast<TResult>(IJavaObject) |
Performs an Android runtime-checked type conversion. |
JavaCast<TResult>(IJavaObject) | |
GetJniTypeName(IJavaPeerable) |