Partager via


LocationManager.RequestSingleUpdate Method

Definition

Overloads

RequestSingleUpdate(String, PendingIntent)

Register for a single location update using a named provider and pending intent.

RequestSingleUpdate(String, ILocationListener, Looper)

Register for a single location update using the named provider and a callback.

RequestSingleUpdate(Criteria, PendingIntent)

Register for a single location update using a Criteria and pending intent.

RequestSingleUpdate(Criteria, ILocationListener, Looper)

Register for a single location update using a Criteria and a callback.

RequestSingleUpdate(String, PendingIntent)

Register for a single location update using a named provider and pending intent.

[Android.Runtime.Register("requestSingleUpdate", "(Ljava/lang/String;Landroid/app/PendingIntent;)V", "GetRequestSingleUpdate_Ljava_lang_String_Landroid_app_PendingIntent_Handler")]
public virtual void RequestSingleUpdate (string provider, Android.App.PendingIntent pendingIntent);
[<Android.Runtime.Register("requestSingleUpdate", "(Ljava/lang/String;Landroid/app/PendingIntent;)V", "GetRequestSingleUpdate_Ljava_lang_String_Landroid_app_PendingIntent_Handler")>]
abstract member RequestSingleUpdate : string * Android.App.PendingIntent -> unit
override this.RequestSingleUpdate : string * Android.App.PendingIntent -> unit

Parameters

provider
String

a provider listed by #getAllProviders()

pendingIntent
PendingIntent

the pending intent to send location updates

Attributes

Exceptions

if provider is null or doesn't exist

if intent is null

if no suitable permission is present

Remarks

Register for a single location update using a named provider and pending intent.

See #requestLocationUpdates(long, float, Criteria, PendingIntent) for more detail on how to use this method.

This member is deprecated. Use #getCurrentLocation(String, CancellationSignal, Executor, Consumer) instead as it does not carry a risk of extreme battery drain.

Java documentation for android.location.LocationManager.requestSingleUpdate(java.lang.String, android.app.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

RequestSingleUpdate(String, ILocationListener, Looper)

Register for a single location update using the named provider and a callback.

[Android.Runtime.Register("requestSingleUpdate", "(Ljava/lang/String;Landroid/location/LocationListener;Landroid/os/Looper;)V", "GetRequestSingleUpdate_Ljava_lang_String_Landroid_location_LocationListener_Landroid_os_Looper_Handler")]
public virtual void RequestSingleUpdate (string provider, Android.Locations.ILocationListener listener, Android.OS.Looper? looper);
[<Android.Runtime.Register("requestSingleUpdate", "(Ljava/lang/String;Landroid/location/LocationListener;Landroid/os/Looper;)V", "GetRequestSingleUpdate_Ljava_lang_String_Landroid_location_LocationListener_Landroid_os_Looper_Handler")>]
abstract member RequestSingleUpdate : string * Android.Locations.ILocationListener * Android.OS.Looper -> unit
override this.RequestSingleUpdate : string * Android.Locations.ILocationListener * Android.OS.Looper -> unit

Parameters

provider
String

a provider listed by #getAllProviders()

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 a single location update using the named provider and a callback.

See #requestLocationUpdates(String, long, float, LocationListener, Looper) for more detail on how to use this method.

This member is deprecated. Use #getCurrentLocation(String, CancellationSignal, Executor, Consumer) instead as it does not carry a risk of extreme battery drain.

Java documentation for android.location.LocationManager.requestSingleUpdate(java.lang.String, android.location.LocationListener, android.os.Looper).

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

RequestSingleUpdate(Criteria, PendingIntent)

Register for a single location update using a Criteria and pending intent.

[Android.Runtime.Register("requestSingleUpdate", "(Landroid/location/Criteria;Landroid/app/PendingIntent;)V", "GetRequestSingleUpdate_Landroid_location_Criteria_Landroid_app_PendingIntent_Handler")]
public virtual void RequestSingleUpdate (Android.Locations.Criteria criteria, Android.App.PendingIntent pendingIntent);
[<Android.Runtime.Register("requestSingleUpdate", "(Landroid/location/Criteria;Landroid/app/PendingIntent;)V", "GetRequestSingleUpdate_Landroid_location_Criteria_Landroid_app_PendingIntent_Handler")>]
abstract member RequestSingleUpdate : Android.Locations.Criteria * Android.App.PendingIntent -> unit
override this.RequestSingleUpdate : Android.Locations.Criteria * Android.App.PendingIntent -> unit

Parameters

criteria
Criteria

contains parameters to choose the appropriate provider for location updates

pendingIntent
PendingIntent

the pending intent to send location updates

Attributes

Exceptions

if provider is null or doesn't exist

if intent is null

if no suitable permission is present

Remarks

Register for a single location update using a Criteria and pending intent.

Note: Since Android KitKat, Criteria requests will always result in using the #FUSED_PROVIDER.

See #requestLocationUpdates(long, float, Criteria, PendingIntent) for more detail on how to use this method.

This member is deprecated. Use #getCurrentLocation(String, CancellationSignal, Executor, Consumer) instead as it does not carry a risk of extreme battery drain.

Java documentation for android.location.LocationManager.requestSingleUpdate(android.location.Criteria, android.app.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

RequestSingleUpdate(Criteria, ILocationListener, Looper)

Register for a single location update using a Criteria and a callback.

[Android.Runtime.Register("requestSingleUpdate", "(Landroid/location/Criteria;Landroid/location/LocationListener;Landroid/os/Looper;)V", "GetRequestSingleUpdate_Landroid_location_Criteria_Landroid_location_LocationListener_Landroid_os_Looper_Handler")]
public virtual void RequestSingleUpdate (Android.Locations.Criteria criteria, Android.Locations.ILocationListener listener, Android.OS.Looper? looper);
[<Android.Runtime.Register("requestSingleUpdate", "(Landroid/location/Criteria;Landroid/location/LocationListener;Landroid/os/Looper;)V", "GetRequestSingleUpdate_Landroid_location_Criteria_Landroid_location_LocationListener_Landroid_os_Looper_Handler")>]
abstract member RequestSingleUpdate : Android.Locations.Criteria * Android.Locations.ILocationListener * Android.OS.Looper -> unit
override this.RequestSingleUpdate : Android.Locations.Criteria * Android.Locations.ILocationListener * Android.OS.Looper -> unit

Parameters

criteria
Criteria

contains parameters to choose the appropriate provider for location updates

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 criteria is null

if listener is null

if no suitable permission is present

Remarks

Register for a single location update using a Criteria and a callback.

Note: Since Android KitKat, Criteria requests will always result in using the #FUSED_PROVIDER.

See #requestLocationUpdates(long, float, Criteria, PendingIntent) for more detail on how to use this method.

This member is deprecated. Use #getCurrentLocation(String, CancellationSignal, Executor, Consumer) instead as it does not carry a risk of extreme battery drain.

Java documentation for android.location.LocationManager.requestSingleUpdate(android.location.Criteria, android.location.LocationListener, android.os.Looper).

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