Android Guides | Samples

Android.Locations.LocationManager Class

This class provides access to the system location services.

See Also: LocationManager

Syntax

[Android.Runtime.Register("android/location/LocationManager", DoNotGenerateAcw=true)]
public class LocationManager : Object

Remarks

This class provides access to the system location services. These services allow applications to obtain periodic updates of the device's geographical location, or to fire an application-specified Intent when the device enters the proximity of a given geographical location.

You do not instantiate this class directly; instead, retrieve it through Context.GetSystemService(String).

Unless noted, all Location API methods require the NoType:android/Manifest$permission;Href=../../../reference/android/Manifest.permission.html#ACCESS_COARSE_LOCATION or Permission.AccessFineLocation permissions. If your application only has the coarse permission then it will not have access to the GPS or passive location providers. Other providers will still return location results, but the update rate will be throttled and the exact location will be obfuscated to a coarse level of accuracy.

[Android Documentation]

Requirements

Namespace: Android.Locations
Assembly: Mono.Android (in Mono.Android.dll)
Assembly Versions: 0.0.0.0
Since: Added in API level 1

The members of Android.Locations.LocationManager are listed below.

See Also: Object

Protected Constructors

A constructor used when creating managed representations of JNI objects; called by the runtime.

Public Fields

const
GpsProviderString. Name of the GPS location provider.
const
KeyLocationChangedString. Key used for a Bundle extra holding a Location value when a location change is broadcast using a PendingIntent.
const
KeyProviderEnabledString. Key used for a Bundle extra holding an Boolean status value when a provider enabled/disabled event is broadcast using a PendingIntent.
const
KeyProximityEnteringString. Key used for the Bundle extra holding a boolean indicating whether a proximity alert is entering (true) or exiting (false).
const
KeyStatusChangedString. Key used for a Bundle extra holding an Integer status value when a status change is broadcast using a PendingIntent.
const
ModeChangedActionString. Broadcast intent action when NoType:android/provider/Settings$Secure;Href=../../../reference/android/provider/Settings.Secure.html#LOCATION_MODE changes.
const
NetworkProviderString. Name of the network location provider.
const
PassiveProviderString. A special location provider for receiving locations without actually initiating a location fix.
const
ProvidersChangedActionString. Broadcast intent action when the configured location providers change.

Public Properties

[read-only]
AllProvidersIList<string>. Returns a list of the names of all known location providers.

Protected Properties

[read-only]
override
ThresholdClassIntPtr. This API supports the Mono for Android infrastructure and is not intended to be used directly from your code.
[read-only]
override
ThresholdTypeType. This API supports the Mono for Android infrastructure and is not intended to be used directly from your code.

Public Methods

AddGpsStatusListener(GpsStatus+IListener) : Boolean
Adds a GPS status listener.
AddNmeaListener(GpsStatus+INmeaListener) : Boolean
Adds an NMEA listener.
AddProximityAlert(Double, Double, Single, Int64, PendingIntent)
Set a proximity alert for the location given by the position (latitude, longitude) and the given radius.
AddTestProvider(String, Boolean, Boolean, Boolean, Boolean, Boolean, Boolean, Boolean, Power, SensorStatus)
Creates a mock location provider and adds it to the set of active providers.
ClearTestProviderEnabled(String)
Removes any mock enabled value associated with the given provider.
ClearTestProviderLocation(String)
Removes any mock location associated with the given provider.
ClearTestProviderStatus(String)
Removes any mock status values associated with the given provider.
static
FromContext(Context) : LocationManager
GetBestProvider(Criteria, Boolean) : String
Returns the name of the provider that best meets the given criteria.
GetGpsStatus(GpsStatus) : GpsStatus
Retrieves information about the current status of the GPS engine.
GetLastKnownLocation(String) : Location
Returns a Location indicating the data from the last known location fix obtained from the given provider.
GetProvider(String) : LocationProvider
Returns the information associated with the location provider of the given name, or null if no provider exists by that name.
GetProviders(Boolean) : IList<string>
Returns a list of the names of location providers.
GetProviders(Criteria, Boolean) : IList<string>
Returns a list of the names of LocationProviders that satisfy the given criteria, or null if none do.
IsProviderEnabled(String) : Boolean
Returns the current enabled/disabled status of the given provider.
RemoveGpsStatusListener(GpsStatus+IListener)
Removes a GPS status listener.
RemoveNmeaListener(GpsStatus+INmeaListener)
Removes an NMEA listener.
RemoveProximityAlert(PendingIntent)
Removes the proximity alert with the given PendingIntent.
RemoveTestProvider(String)
Removes the mock location provider with the given name.
RemoveUpdates(PendingIntent)
Removes all location updates for the specified pending intent.
RemoveUpdates(ILocationListener)
Removes all location updates for the specified LocationListener.
RequestLocationUpdates(Int64, Single, Criteria, PendingIntent)
Register for location updates using a Criteria and pending intent.
RequestLocationUpdates(String, Int64, Single, PendingIntent)
Register for location updates using the named provider, and a pending intent.
RequestLocationUpdates(String, Int64, Single, ILocationListener)
Register for location updates using the named provider, and a pending intent.
RequestLocationUpdates(Int64, Single, Criteria, ILocationListener, Looper)
Register for location updates using a Criteria, and a callback on the specified looper thread.
RequestLocationUpdates(String, Int64, Single, ILocationListener, Looper)
Register for location updates using the named provider, and a callback on the specified looper thread.
RequestSingleUpdate(Criteria, PendingIntent)
Register for a single location update using a Criteria and pending intent.
RequestSingleUpdate(String, PendingIntent)
Register for a single location update using a named provider and pending intent.
RequestSingleUpdate(Criteria, ILocationListener, Looper)
Register for a single location update using a Criteria and a callback.
RequestSingleUpdate(String, ILocationListener, Looper)
Register for a single location update using the named provider and a callback.
SendExtraCommand(String, String, Bundle) : Boolean
Sends additional commands to a location provider.
SetTestProviderEnabled(String, Boolean)
Sets a mock enabled value for the given provider.
SetTestProviderLocation(String, Location)
Sets a mock location for the given provider.
SetTestProviderStatus(String, Availability, Bundle, Int64)
Sets mock status values for the given provider.