LocationManager.RequestLocationUpdates Method
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.
Overloads
RequestLocationUpdates(String, LocationRequest, PendingIntent) |
Register for ___location updates from the specified provider, using a |
RequestLocationUpdates(Int64, Single, Criteria, PendingIntent) |
Register for ___location updates using a provider selected through the given Criteria, and
callbacks delivered via the provided |
RequestLocationUpdates(String, LocationRequest, IExecutor, ILocationListener) |
Register for ___location updates from the specified provider, using a |
RequestLocationUpdates(String, Int64, Single, PendingIntent) |
Register for ___location updates using the named provider, and callbacks delivered via the
provided |
RequestLocationUpdates(String, Int64, Single, ILocationListener) |
Register for ___location updates from the given provider with the given arguments, and a
callback on the |
RequestLocationUpdates(Int64, Single, Criteria, ILocationListener, Looper) |
Register for ___location updates using a provider selected through the given Criteria, and a
callback on the specified |
RequestLocationUpdates(Int64, Single, Criteria, IExecutor, ILocationListener) |
Register for ___location updates using a provider selected through the given Criteria, and a
callback on the specified |
RequestLocationUpdates(String, Int64, Single, ILocationListener, Looper) |
Register for ___location updates from the given provider with the given arguments, and a
callback on the specified |
RequestLocationUpdates(String, Int64, Single, IExecutor, ILocationListener) |
Register for ___location updates using the named provider, and a callback on
the specified |
RequestLocationUpdates(String, LocationRequest, PendingIntent)
Register for ___location updates from the specified provider, using a LocationRequest
,
and callbacks delivered via the provided PendingIntent
.
[Android.Runtime.Register("requestLocationUpdates", "(Ljava/lang/String;Landroid/___location/LocationRequest;Landroid/app/PendingIntent;)V", "GetRequestLocationUpdates_Ljava_lang_String_Landroid_location_LocationRequest_Landroid_app_PendingIntent_Handler", ApiSince=31)]
public virtual void RequestLocationUpdates(string provider, Android.Locations.LocationRequest locationRequest, Android.App.PendingIntent pendingIntent);
[<Android.Runtime.Register("requestLocationUpdates", "(Ljava/lang/String;Landroid/___location/LocationRequest;Landroid/app/PendingIntent;)V", "GetRequestLocationUpdates_Ljava_lang_String_Landroid_location_LocationRequest_Landroid_app_PendingIntent_Handler", ApiSince=31)>]
abstract member RequestLocationUpdates : string * Android.Locations.LocationRequest * Android.App.PendingIntent -> unit
override this.RequestLocationUpdates : string * Android.Locations.LocationRequest * Android.App.PendingIntent -> unit
Parameters
- provider
- String
a provider listed by #getAllProviders()
- locationRequest
- LocationRequest
the ___location request containing ___location parameters
- pendingIntent
- PendingIntent
the pending intent to send ___location updates
- Attributes
Remarks
Register for ___location updates from the specified provider, using a LocationRequest
, and callbacks delivered via the provided PendingIntent
.
The delivered pending intents will contain extras with the callback information. The keys used for the extras are #KEY_LOCATION_CHANGED
and #KEY_PROVIDER_ENABLED
. See the documentation for each respective extra key for information on the values.
To unregister for ___location updates, use #removeUpdates(PendingIntent)
.
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.
Applies to
RequestLocationUpdates(Int64, Single, Criteria, PendingIntent)
Register for ___location updates using a provider selected through the given Criteria, and
callbacks delivered via the provided PendingIntent
.
[Android.Runtime.Register("requestLocationUpdates", "(JFLandroid/___location/Criteria;Landroid/app/PendingIntent;)V", "GetRequestLocationUpdates_JFLandroid_location_Criteria_Landroid_app_PendingIntent_Handler")]
public virtual void RequestLocationUpdates(long minTimeMs, float minDistanceM, Android.Locations.Criteria criteria, Android.App.PendingIntent pendingIntent);
[<Android.Runtime.Register("requestLocationUpdates", "(JFLandroid/___location/Criteria;Landroid/app/PendingIntent;)V", "GetRequestLocationUpdates_JFLandroid_location_Criteria_Landroid_app_PendingIntent_Handler")>]
abstract member RequestLocationUpdates : int64 * single * Android.Locations.Criteria * Android.App.PendingIntent -> unit
override this.RequestLocationUpdates : int64 * single * Android.Locations.Criteria * Android.App.PendingIntent -> unit
Parameters
- minTimeMs
- Int64
minimum time interval between ___location updates in milliseconds
- minDistanceM
- Single
minimum distance between ___location updates in meters
- criteria
- Criteria
contains parameters to choose the appropriate provider for ___location updates
- pendingIntent
- PendingIntent
the pending intent to send ___location updates
- Attributes
Exceptions
if criteria is null
if intent is null
if no suitable permission is present
Remarks
Register for ___location updates using a provider selected through the given Criteria, and callbacks delivered via the provided PendingIntent
.
Note: Since Android KitKat, Criteria requests will always result in using the #FUSED_PROVIDER
.
See #requestLocationUpdates(String, long, float, PendingIntent)
for more detail on how this method works.
This member is deprecated. Use #requestLocationUpdates(String, long, float, PendingIntent)
instead to explicitly select a provider.
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.
Applies to
RequestLocationUpdates(String, LocationRequest, IExecutor, ILocationListener)
Register for ___location updates from the specified provider, using a LocationRequest
,
and a callback on the specified Executor
.
[Android.Runtime.Register("requestLocationUpdates", "(Ljava/lang/String;Landroid/___location/LocationRequest;Ljava/util/concurrent/Executor;Landroid/___location/LocationListener;)V", "GetRequestLocationUpdates_Ljava_lang_String_Landroid_location_LocationRequest_Ljava_util_concurrent_Executor_Landroid_location_LocationListener_Handler", ApiSince=31)]
public virtual void RequestLocationUpdates(string provider, Android.Locations.LocationRequest locationRequest, Java.Util.Concurrent.IExecutor executor, Android.Locations.ILocationListener listener);
[<Android.Runtime.Register("requestLocationUpdates", "(Ljava/lang/String;Landroid/___location/LocationRequest;Ljava/util/concurrent/Executor;Landroid/___location/LocationListener;)V", "GetRequestLocationUpdates_Ljava_lang_String_Landroid_location_LocationRequest_Ljava_util_concurrent_Executor_Landroid_location_LocationListener_Handler", ApiSince=31)>]
abstract member RequestLocationUpdates : string * Android.Locations.LocationRequest * Java.Util.Concurrent.IExecutor * Android.Locations.ILocationListener -> unit
override this.RequestLocationUpdates : string * Android.Locations.LocationRequest * Java.Util.Concurrent.IExecutor * Android.Locations.ILocationListener -> unit
Parameters
- provider
- String
a provider listed by #getAllProviders()
- locationRequest
- LocationRequest
the ___location request containing ___location parameters
- executor
- IExecutor
the executor handling listener callbacks
- listener
- ILocationListener
the listener to receive ___location updates
- Attributes
Remarks
Register for ___location updates from the specified provider, using a LocationRequest
, and a callback on the specified Executor
.
Only one request can be registered for each unique listener/provider pair, so any subsequent requests with the same provider and listener will overwrite all associated arguments. The same listener may be used across multiple providers with different requests for each provider.
It may take some time to receive the first ___location update depending on the conditions the device finds itself in. In order to take advantage of cached locations, application may consider using #getLastKnownLocation(String)
or #getCurrentLocation(String, LocationRequest, CancellationSignal, Executor, Consumer)
instead.
See LocationRequest
documentation for an explanation of various request parameters and how they can affect the received locations.
If your application wants to passively observe ___location updates from all providers, then use the #PASSIVE_PROVIDER
. This provider does not turn on or modify active ___location providers, so you do not need to be as careful about minimum time and minimum distance parameters. However, if your application performs heavy work on a ___location update (such as network activity) then you should set an explicit fastest interval on your ___location request in case another application enables a ___location provider with extremely fast updates.
In case the provider you have selected is disabled, ___location updates will cease, and a provider availability update will be sent. As soon as the provider is enabled again, another provider availability update will be sent and ___location updates will resume.
Locations returned from #GPS_PROVIDER
are with respect to the primary GNSS antenna position within the device. #getGnssAntennaInfos()
may be used to determine the GNSS antenna position with respect to the Android Coordinate System, and convert between them if necessary. This is generally only necessary for high accuracy applications.
When ___location callbacks are invoked, the system will hold a wakelock on your application's behalf for some period of time, but not indefinitely. If your application requires a long running wakelock within the ___location callback, you should acquire it yourself.
Spamming ___location requests is a drain on system resources, and the system has preventative measures in place to ensure that this behavior will never result in more locations than could be achieved with a single ___location request with an equivalent interval that is left in place the whole time. As part of this amelioration, applications that target Android S and above may receive cached or historical locations through their listener. These locations will never be older than the interval of the ___location request.
To unregister for ___location updates, use #removeUpdates(LocationListener)
.
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.
Applies to
RequestLocationUpdates(String, Int64, Single, PendingIntent)
Register for ___location updates using the named provider, and callbacks delivered via the
provided PendingIntent
.
[Android.Runtime.Register("requestLocationUpdates", "(Ljava/lang/String;JFLandroid/app/PendingIntent;)V", "GetRequestLocationUpdates_Ljava_lang_String_JFLandroid_app_PendingIntent_Handler")]
public virtual void RequestLocationUpdates(string provider, long minTimeMs, float minDistanceM, Android.App.PendingIntent pendingIntent);
[<Android.Runtime.Register("requestLocationUpdates", "(Ljava/lang/String;JFLandroid/app/PendingIntent;)V", "GetRequestLocationUpdates_Ljava_lang_String_JFLandroid_app_PendingIntent_Handler")>]
abstract member RequestLocationUpdates : string * int64 * single * Android.App.PendingIntent -> unit
override this.RequestLocationUpdates : string * int64 * single * Android.App.PendingIntent -> unit
Parameters
- provider
- String
a provider listed by #getAllProviders()
- minTimeMs
- Int64
minimum time interval between ___location updates in milliseconds
- minDistanceM
- Single
minimum distance between ___location updates in meters
- pendingIntent
- PendingIntent
the pending intent to send ___location updates
- Attributes
Exceptions
if provider is null or doesn't exist on this device
if intent is null
if no suitable permission is present
Remarks
Register for ___location updates using the named provider, and callbacks delivered via the provided PendingIntent
.
See #requestLocationUpdates(String, LocationRequest, PendingIntent)
for more detail on how this method works.
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.
Applies to
RequestLocationUpdates(String, Int64, Single, ILocationListener)
Register for ___location updates from the given provider with the given arguments, and a
callback on the Looper
of the calling thread.
[Android.Runtime.Register("requestLocationUpdates", "(Ljava/lang/String;JFLandroid/___location/LocationListener;)V", "GetRequestLocationUpdates_Ljava_lang_String_JFLandroid_location_LocationListener_Handler")]
public virtual void RequestLocationUpdates(string provider, long minTimeMs, float minDistanceM, Android.Locations.ILocationListener listener);
[<Android.Runtime.Register("requestLocationUpdates", "(Ljava/lang/String;JFLandroid/___location/LocationListener;)V", "GetRequestLocationUpdates_Ljava_lang_String_JFLandroid_location_LocationListener_Handler")>]
abstract member RequestLocationUpdates : string * int64 * single * Android.Locations.ILocationListener -> unit
override this.RequestLocationUpdates : string * int64 * single * Android.Locations.ILocationListener -> unit
Parameters
- provider
- String
a provider listed by #getAllProviders()
- minTimeMs
- Int64
minimum time interval between ___location updates in milliseconds
- minDistanceM
- Single
minimum distance between ___location updates in meters
- listener
- ILocationListener
the listener to receive ___location updates
- Attributes
Exceptions
if provider is null or doesn't exist on this device
if listener is null
if the calling thread has no Looper
if no suitable permission is present
Remarks
Register for ___location updates from the given provider with the given arguments, and a callback on the Looper
of the calling thread.
See #requestLocationUpdates(String, LocationRequest, Executor, LocationListener)
for more detail on how this method works.
Prior to Jellybean, the minTime parameter was only a hint, and some ___location provider implementations ignored it. For Jellybean and onwards however, it is mandatory for Android compatible devices to observe both the minTime and minDistance parameters.
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.
Applies to
RequestLocationUpdates(Int64, Single, Criteria, ILocationListener, Looper)
Register for ___location updates using a provider selected through the given Criteria, and a
callback on the specified Looper
.
[Android.Runtime.Register("requestLocationUpdates", "(JFLandroid/___location/Criteria;Landroid/___location/LocationListener;Landroid/os/Looper;)V", "GetRequestLocationUpdates_JFLandroid_location_Criteria_Landroid_location_LocationListener_Landroid_os_Looper_Handler")]
public virtual void RequestLocationUpdates(long minTimeMs, float minDistanceM, Android.Locations.Criteria criteria, Android.Locations.ILocationListener listener, Android.OS.Looper? looper);
[<Android.Runtime.Register("requestLocationUpdates", "(JFLandroid/___location/Criteria;Landroid/___location/LocationListener;Landroid/os/Looper;)V", "GetRequestLocationUpdates_JFLandroid_location_Criteria_Landroid_location_LocationListener_Landroid_os_Looper_Handler")>]
abstract member RequestLocationUpdates : int64 * single * Android.Locations.Criteria * Android.Locations.ILocationListener * Android.OS.Looper -> unit
override this.RequestLocationUpdates : int64 * single * Android.Locations.Criteria * Android.Locations.ILocationListener * Android.OS.Looper -> unit
Parameters
- minTimeMs
- Int64
minimum time interval between ___location updates in milliseconds
- minDistanceM
- Single
minimum distance between ___location updates in meters
- criteria
- Criteria
contains parameters to choose the appropriate provider for ___location updates
- listener
- ILocationListener
the listener to receive ___location updates
- looper
- Looper
a Looper object whose message queue will be used to implement the callback mechanism, or null to make callbacks on the calling thread
- Attributes
Exceptions
if criteria is null
if listener is null
if no suitable permission is present
Remarks
Register for ___location updates using a provider selected through the given Criteria, and a callback on the specified Looper
.
Note: Since Android KitKat, Criteria requests will always result in using the #FUSED_PROVIDER
.
See #requestLocationUpdates(String, LocationRequest, Executor, LocationListener)
for more detail on how this method works.
This member is deprecated. Use #requestLocationUpdates(String, long, float, LocationListener, Looper)
instead to explicitly select a provider.
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.
Applies to
RequestLocationUpdates(Int64, Single, Criteria, IExecutor, ILocationListener)
Register for ___location updates using a provider selected through the given Criteria, and a
callback on the specified Executor
.
[Android.Runtime.Register("requestLocationUpdates", "(JFLandroid/___location/Criteria;Ljava/util/concurrent/Executor;Landroid/___location/LocationListener;)V", "GetRequestLocationUpdates_JFLandroid_location_Criteria_Ljava_util_concurrent_Executor_Landroid_location_LocationListener_Handler", ApiSince=30)]
public virtual void RequestLocationUpdates(long minTimeMs, float minDistanceM, Android.Locations.Criteria criteria, Java.Util.Concurrent.IExecutor executor, Android.Locations.ILocationListener listener);
[<Android.Runtime.Register("requestLocationUpdates", "(JFLandroid/___location/Criteria;Ljava/util/concurrent/Executor;Landroid/___location/LocationListener;)V", "GetRequestLocationUpdates_JFLandroid_location_Criteria_Ljava_util_concurrent_Executor_Landroid_location_LocationListener_Handler", ApiSince=30)>]
abstract member RequestLocationUpdates : int64 * single * Android.Locations.Criteria * Java.Util.Concurrent.IExecutor * Android.Locations.ILocationListener -> unit
override this.RequestLocationUpdates : int64 * single * Android.Locations.Criteria * Java.Util.Concurrent.IExecutor * Android.Locations.ILocationListener -> unit
Parameters
- minTimeMs
- Int64
minimum time interval between ___location updates in milliseconds
- minDistanceM
- Single
minimum distance between ___location updates in meters
- criteria
- Criteria
contains parameters to choose the appropriate provider for ___location updates
- executor
- IExecutor
the executor handling listener callbacks
- listener
- ILocationListener
the listener to receive ___location updates
- Attributes
Remarks
Register for ___location updates using a provider selected through the given Criteria, and a callback on the specified Executor
.
Note: Since Android KitKat, Criteria requests will always result in using the #FUSED_PROVIDER
.
See #requestLocationUpdates(String, LocationRequest, Executor, LocationListener)
for more detail on how this method works.
This member is deprecated. Use #requestLocationUpdates(String, long, float, Executor, LocationListener)
instead to explicitly select a provider.
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.
Applies to
RequestLocationUpdates(String, Int64, Single, ILocationListener, Looper)
Register for ___location updates from the given provider with the given arguments, and a
callback on the specified Looper
.
[Android.Runtime.Register("requestLocationUpdates", "(Ljava/lang/String;JFLandroid/___location/LocationListener;Landroid/os/Looper;)V", "GetRequestLocationUpdates_Ljava_lang_String_JFLandroid_location_LocationListener_Landroid_os_Looper_Handler")]
public virtual void RequestLocationUpdates(string provider, long minTimeMs, float minDistanceM, Android.Locations.ILocationListener listener, Android.OS.Looper? looper);
[<Android.Runtime.Register("requestLocationUpdates", "(Ljava/lang/String;JFLandroid/___location/LocationListener;Landroid/os/Looper;)V", "GetRequestLocationUpdates_Ljava_lang_String_JFLandroid_location_LocationListener_Landroid_os_Looper_Handler")>]
abstract member RequestLocationUpdates : string * int64 * single * Android.Locations.ILocationListener * Android.OS.Looper -> unit
override this.RequestLocationUpdates : string * int64 * single * Android.Locations.ILocationListener * Android.OS.Looper -> unit
Parameters
- provider
- String
a provider listed by #getAllProviders()
- minTimeMs
- Int64
minimum time interval between ___location updates in milliseconds
- minDistanceM
- Single
minimum distance between ___location updates in meters
- listener
- ILocationListener
the listener to receive ___location updates
- looper
- Looper
the looper handling listener callbacks, or null to use the looper of the calling thread
- Attributes
Exceptions
if provider is null or doesn't exist
if listener is null
if no suitable permission is present
Remarks
Register for ___location updates from the given provider with the given arguments, and a callback on the specified Looper
.
See #requestLocationUpdates(String, LocationRequest, Executor, LocationListener)
for more detail on how this method works.
Prior to Jellybean, the minTime parameter was only a hint, and some ___location provider implementations ignored it. For Jellybean and onwards however, it is mandatory for Android compatible devices to observe both the minTime and minDistance parameters.
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.
Applies to
RequestLocationUpdates(String, Int64, Single, IExecutor, ILocationListener)
Register for ___location updates using the named provider, and a callback on
the specified Executor
.
[Android.Runtime.Register("requestLocationUpdates", "(Ljava/lang/String;JFLjava/util/concurrent/Executor;Landroid/___location/LocationListener;)V", "GetRequestLocationUpdates_Ljava_lang_String_JFLjava_util_concurrent_Executor_Landroid_location_LocationListener_Handler", ApiSince=30)]
public virtual void RequestLocationUpdates(string provider, long minTimeMs, float minDistanceM, Java.Util.Concurrent.IExecutor executor, Android.Locations.ILocationListener listener);
[<Android.Runtime.Register("requestLocationUpdates", "(Ljava/lang/String;JFLjava/util/concurrent/Executor;Landroid/___location/LocationListener;)V", "GetRequestLocationUpdates_Ljava_lang_String_JFLjava_util_concurrent_Executor_Landroid_location_LocationListener_Handler", ApiSince=30)>]
abstract member RequestLocationUpdates : string * int64 * single * Java.Util.Concurrent.IExecutor * Android.Locations.ILocationListener -> unit
override this.RequestLocationUpdates : string * int64 * single * Java.Util.Concurrent.IExecutor * Android.Locations.ILocationListener -> unit
Parameters
- provider
- String
a provider listed by #getAllProviders()
- minTimeMs
- Int64
minimum time interval between ___location updates in milliseconds
- minDistanceM
- Single
minimum distance between ___location updates in meters
- executor
- IExecutor
the executor handling listener callbacks
- listener
- ILocationListener
the listener to receive ___location updates
- Attributes
Remarks
Register for ___location updates using the named provider, and a callback on the specified Executor
.
See #requestLocationUpdates(String, LocationRequest, Executor, LocationListener)
for more detail on how this method works.
Prior to Jellybean, the minTime parameter was only a hint, and some ___location provider implementations ignored it. For Jellybean and onwards however, it is mandatory for Android compatible devices to observe both the minTime and minDistance parameters.
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.